//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension CloudTrail {
    // MARK: Enums

    public enum BillingMode: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case extendableRetentionPricing = "EXTENDABLE_RETENTION_PRICING"
        case fixedRetentionPricing = "FIXED_RETENTION_PRICING"
        public var description: String { return self.rawValue }
    }

    public enum DashboardStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case created = "CREATED"
        case creating = "CREATING"
        case deleting = "DELETING"
        case updated = "UPDATED"
        case updating = "UPDATING"
        public var description: String { return self.rawValue }
    }

    public enum DashboardType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case custom = "CUSTOM"
        case managed = "MANAGED"
        public var description: String { return self.rawValue }
    }

    public enum DeliveryStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case accessDenied = "ACCESS_DENIED"
        case accessDeniedSigningFile = "ACCESS_DENIED_SIGNING_FILE"
        case cancelled = "CANCELLED"
        case failed = "FAILED"
        case failedSigningFile = "FAILED_SIGNING_FILE"
        case pending = "PENDING"
        case resourceNotFound = "RESOURCE_NOT_FOUND"
        case success = "SUCCESS"
        case unknown = "UNKNOWN"
        public var description: String { return self.rawValue }
    }

    public enum DestinationType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case awsService = "AWS_SERVICE"
        case eventDataStore = "EVENT_DATA_STORE"
        public var description: String { return self.rawValue }
    }

    public enum EventCategory: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case insight = "insight"
        public var description: String { return self.rawValue }
    }

    public enum EventDataStoreStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case created = "CREATED"
        case enabled = "ENABLED"
        case pendingDeletion = "PENDING_DELETION"
        case startingIngestion = "STARTING_INGESTION"
        case stoppedIngestion = "STOPPED_INGESTION"
        case stoppingIngestion = "STOPPING_INGESTION"
        public var description: String { return self.rawValue }
    }

    public enum FederationStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case disabled = "DISABLED"
        case disabling = "DISABLING"
        case enabled = "ENABLED"
        case enabling = "ENABLING"
        public var description: String { return self.rawValue }
    }

    public enum ImportFailureStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case failed = "FAILED"
        case retry = "RETRY"
        case succeeded = "SUCCEEDED"
        public var description: String { return self.rawValue }
    }

    public enum ImportStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case completed = "COMPLETED"
        case failed = "FAILED"
        case inProgress = "IN_PROGRESS"
        case initializing = "INITIALIZING"
        case stopped = "STOPPED"
        public var description: String { return self.rawValue }
    }

    public enum InsightType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case apiCallRateInsight = "ApiCallRateInsight"
        case apiErrorRateInsight = "ApiErrorRateInsight"
        public var description: String { return self.rawValue }
    }

    public enum InsightsMetricDataType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case fillWithZeros = "FillWithZeros"
        case nonZeroData = "NonZeroData"
        public var description: String { return self.rawValue }
    }

    public enum LookupAttributeKey: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case accessKeyId = "AccessKeyId"
        case eventId = "EventId"
        case eventName = "EventName"
        case eventSource = "EventSource"
        case readOnly = "ReadOnly"
        case resourceName = "ResourceName"
        case resourceType = "ResourceType"
        case username = "Username"
        public var description: String { return self.rawValue }
    }

    public enum MaxEventSize: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case large = "Large"
        case standard = "Standard"
        public var description: String { return self.rawValue }
    }

    public enum QueryStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case cancelled = "CANCELLED"
        case failed = "FAILED"
        case finished = "FINISHED"
        case queued = "QUEUED"
        case running = "RUNNING"
        case timedOut = "TIMED_OUT"
        public var description: String { return self.rawValue }
    }

    public enum ReadWriteType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case all = "All"
        case readOnly = "ReadOnly"
        case writeOnly = "WriteOnly"
        public var description: String { return self.rawValue }
    }

    public enum RefreshScheduleFrequencyUnit: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case days = "DAYS"
        case hours = "HOURS"
        public var description: String { return self.rawValue }
    }

    public enum RefreshScheduleStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case disabled = "DISABLED"
        case enabled = "ENABLED"
        public var description: String { return self.rawValue }
    }

    public enum `Type`: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case requestContext = "RequestContext"
        case tagContext = "TagContext"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AddTagsRequest: AWSEncodableShape {
        /// Specifies the ARN of the trail, event data store, dashboard, or channel to which one or more tags will be added. The format of a trail ARN is: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  The format of an event data store ARN is: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  The format of a dashboard ARN is: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  The format of a channel ARN is: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceId: String
        /// Contains a list of tags, up to a limit of 50
        public let tagsList: [Tag]

        @inlinable
        public init(resourceId: String, tagsList: [Tag]) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        public func validate(name: String) throws {
            try self.tagsList.forEach {
                try $0.validate(name: "\(name).tagsList[]")
            }
            try self.validate(self.tagsList, name: "tagsList", parent: name, max: 200)
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct AddTagsResponse: AWSDecodableShape {
        public init() {}
    }

    public struct AdvancedEventSelector: AWSEncodableShape & AWSDecodableShape {
        /// Contains all selector statements in an advanced event selector.
        public let fieldSelectors: [AdvancedFieldSelector]
        /// An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".
        public let name: String?

        @inlinable
        public init(fieldSelectors: [AdvancedFieldSelector], name: String? = nil) {
            self.fieldSelectors = fieldSelectors
            self.name = name
        }

        public func validate(name: String) throws {
            try self.fieldSelectors.forEach {
                try $0.validate(name: "\(name).fieldSelectors[]")
            }
            try self.validate(self.fieldSelectors, name: "fieldSelectors", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 1000)
            try self.validate(self.name, name: "name", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case fieldSelectors = "FieldSelectors"
            case name = "Name"
        }
    }

    public struct AdvancedFieldSelector: AWSEncodableShape & AWSDecodableShape {
        /// An operator that includes events that match the last few characters of the event record field specified as the value of Field.
        public let endsWith: [String]?
        ///  An operator that includes events that match the exact value of the event record field specified as the value of Field. This is the only valid operator that you can use with the readOnly, eventCategory, and resources.type fields.
        public let equals: [String]?
        ///  A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see  AdvancedFieldSelector  in the CloudTrail API Reference.  Selectors don't support the use of wildcards like * . To match multiple values with a single condition,  you may use StartsWith, EndsWith, NotStartsWith, or NotEndsWith to explicitly match the beginning or end of the event field.
        public let field: String
        ///  An operator that excludes events that match the last few characters of the event record field specified as the value of Field.
        public let notEndsWith: [String]?
        ///  An operator that excludes events that match the exact value of the event record field specified as the value of Field.
        public let notEquals: [String]?
        ///  An operator that excludes events that match the first few characters of the event record field specified as the value of Field.
        public let notStartsWith: [String]?
        /// An operator that includes events that match the first few characters of the event record field specified as the value of Field.
        public let startsWith: [String]?

        @inlinable
        public init(endsWith: [String]? = nil, equals: [String]? = nil, field: String, notEndsWith: [String]? = nil, notEquals: [String]? = nil, notStartsWith: [String]? = nil, startsWith: [String]? = nil) {
            self.endsWith = endsWith
            self.equals = equals
            self.field = field
            self.notEndsWith = notEndsWith
            self.notEquals = notEquals
            self.notStartsWith = notStartsWith
            self.startsWith = startsWith
        }

        public func validate(name: String) throws {
            try self.endsWith?.forEach {
                try validate($0, name: "endsWith[]", parent: name, max: 2048)
                try validate($0, name: "endsWith[]", parent: name, min: 1)
                try validate($0, name: "endsWith[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.endsWith, name: "endsWith", parent: name, min: 1)
            try self.equals?.forEach {
                try validate($0, name: "equals[]", parent: name, max: 2048)
                try validate($0, name: "equals[]", parent: name, min: 1)
                try validate($0, name: "equals[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.equals, name: "equals", parent: name, min: 1)
            try self.validate(self.field, name: "field", parent: name, max: 1000)
            try self.validate(self.field, name: "field", parent: name, min: 1)
            try self.validate(self.field, name: "field", parent: name, pattern: "^[\\w|\\d|\\.|_]+$")
            try self.notEndsWith?.forEach {
                try validate($0, name: "notEndsWith[]", parent: name, max: 2048)
                try validate($0, name: "notEndsWith[]", parent: name, min: 1)
                try validate($0, name: "notEndsWith[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.notEndsWith, name: "notEndsWith", parent: name, min: 1)
            try self.notEquals?.forEach {
                try validate($0, name: "notEquals[]", parent: name, max: 2048)
                try validate($0, name: "notEquals[]", parent: name, min: 1)
                try validate($0, name: "notEquals[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.notEquals, name: "notEquals", parent: name, min: 1)
            try self.notStartsWith?.forEach {
                try validate($0, name: "notStartsWith[]", parent: name, max: 2048)
                try validate($0, name: "notStartsWith[]", parent: name, min: 1)
                try validate($0, name: "notStartsWith[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.notStartsWith, name: "notStartsWith", parent: name, min: 1)
            try self.startsWith?.forEach {
                try validate($0, name: "startsWith[]", parent: name, max: 2048)
                try validate($0, name: "startsWith[]", parent: name, min: 1)
                try validate($0, name: "startsWith[]", parent: name, pattern: "^.+$")
            }
            try self.validate(self.startsWith, name: "startsWith", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case endsWith = "EndsWith"
            case equals = "Equals"
            case field = "Field"
            case notEndsWith = "NotEndsWith"
            case notEquals = "NotEquals"
            case notStartsWith = "NotStartsWith"
            case startsWith = "StartsWith"
        }
    }

    public struct CancelQueryRequest: AWSEncodableShape {
        /// The ARN (or the ID suffix of the ARN) of an event data store on which the specified query is running.
        public let eventDataStore: String?
        /// The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        /// The ID of the query that you want to cancel. The QueryId comes from the response of a StartQuery operation.
        public let queryId: String

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, queryId: String) {
            self.eventDataStore = nil
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryId = queryId
        }

        @available(*, deprecated, message: "Members eventDataStore have been deprecated")
        @inlinable
        public init(eventDataStore: String? = nil, eventDataStoreOwnerAccountId: String? = nil, queryId: String) {
            self.eventDataStore = eventDataStore
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryId = queryId
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, max: 16)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, min: 12)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, pattern: "^\\d+$")
            try self.validate(self.queryId, name: "queryId", parent: name, max: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, min: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, pattern: "^[a-f0-9\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryId = "QueryId"
        }
    }

    public struct CancelQueryResponse: AWSDecodableShape {
        ///  The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        /// The ID of the canceled query.
        public let queryId: String
        /// Shows the status of a query after a CancelQuery request. Typically, the values shown are either RUNNING or CANCELLED.
        public let queryStatus: QueryStatus

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, queryId: String, queryStatus: QueryStatus) {
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryId = queryId
            self.queryStatus = queryStatus
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryId = "QueryId"
            case queryStatus = "QueryStatus"
        }
    }

    public struct Channel: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of a channel.
        public let channelArn: String?
        ///  The name of the CloudTrail channel. For service-linked channels, the name is aws-service-channel/service-name/custom-suffix where service-name represents the name of the Amazon Web Services service that created the channel and custom-suffix represents the suffix created by the Amazon Web Services service.
        public let name: String?

        @inlinable
        public init(channelArn: String? = nil, name: String? = nil) {
            self.channelArn = channelArn
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case channelArn = "ChannelArn"
            case name = "Name"
        }
    }

    public struct ContextKeySelector: AWSEncodableShape & AWSDecodableShape {
        /// A list of keys defined by Type to be included in CloudTrail enriched events.
        public let equals: [String]
        /// Specifies the type of the event record field in ContextKeySelector. Valid values include RequestContext, TagContext.
        public let type: `Type`

        @inlinable
        public init(equals: [String], type: `Type`) {
            self.equals = equals
            self.type = type
        }

        public func validate(name: String) throws {
            try self.equals.forEach {
                try validate($0, name: "equals[]", parent: name, max: 128)
                try validate($0, name: "equals[]", parent: name, min: 1)
            }
            try self.validate(self.equals, name: "equals", parent: name, max: 50)
            try self.validate(self.equals, name: "equals", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case equals = "Equals"
            case type = "Type"
        }
    }

    public struct CreateChannelRequest: AWSEncodableShape {
        /// One or more event data stores to which events arriving through a channel will be logged.
        public let destinations: [Destination]
        /// The name of the channel.
        public let name: String
        /// The name of the partner or external event source. You cannot change this name after you create the  channel. A maximum of one channel is allowed per source.  A source can be either Custom for all valid non-Amazon Web Services events, or the name of a partner event source. For information about the source names for available partners, see Additional information about integration partners in the CloudTrail User Guide.
        public let source: String
        public let tags: [Tag]?

        @inlinable
        public init(destinations: [Destination], name: String, source: String, tags: [Tag]? = nil) {
            self.destinations = destinations
            self.name = name
            self.source = source
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.destinations.forEach {
                try $0.validate(name: "\(name).destinations[]")
            }
            try self.validate(self.destinations, name: "destinations", parent: name, max: 200)
            try self.validate(self.destinations, name: "destinations", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 128)
            try self.validate(self.name, name: "name", parent: name, min: 3)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9._\\-]+$")
            try self.validate(self.source, name: "source", parent: name, max: 256)
            try self.validate(self.source, name: "source", parent: name, min: 1)
            try self.validate(self.source, name: "source", parent: name, pattern: ".*")
            try self.tags?.forEach {
                try $0.validate(name: "\(name).tags[]")
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 200)
        }

        private enum CodingKeys: String, CodingKey {
            case destinations = "Destinations"
            case name = "Name"
            case source = "Source"
            case tags = "Tags"
        }
    }

    public struct CreateChannelResponse: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the new channel.
        public let channelArn: String?
        /// The event data stores that log the events arriving through the channel.
        public let destinations: [Destination]?
        /// The name of the new channel.
        public let name: String?
        /// The partner or external event source name.
        public let source: String?
        public let tags: [Tag]?

        @inlinable
        public init(channelArn: String? = nil, destinations: [Destination]? = nil, name: String? = nil, source: String? = nil, tags: [Tag]? = nil) {
            self.channelArn = channelArn
            self.destinations = destinations
            self.name = name
            self.source = source
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case channelArn = "ChannelArn"
            case destinations = "Destinations"
            case name = "Name"
            case source = "Source"
            case tags = "Tags"
        }
    }

    public struct CreateDashboardRequest: AWSEncodableShape {
        ///  The name of the dashboard. The name must be unique to your account.
        ///  To create the Highlights dashboard, the name must be AWSCloudTrail-Highlights.
        public let name: String
        ///  The refresh schedule configuration for the dashboard.
        ///  To create the Highlights dashboard, you must set a refresh schedule and set the Status to ENABLED. The Unit for the refresh schedule must be HOURS  and the Value must be 6.
        public let refreshSchedule: RefreshSchedule?
        public let tagsList: [Tag]?
        ///  Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.
        public let terminationProtectionEnabled: Bool?
        /// An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets.
        ///  You do not need to specify widgets for the Highlights dashboard.
        public let widgets: [RequestWidget]?

        @inlinable
        public init(name: String, refreshSchedule: RefreshSchedule? = nil, tagsList: [Tag]? = nil, terminationProtectionEnabled: Bool? = nil, widgets: [RequestWidget]? = nil) {
            self.name = name
            self.refreshSchedule = refreshSchedule
            self.tagsList = tagsList
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.widgets = widgets
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 128)
            try self.validate(self.name, name: "name", parent: name, min: 3)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9_\\-]+$")
            try self.refreshSchedule?.validate(name: "\(name).refreshSchedule")
            try self.tagsList?.forEach {
                try $0.validate(name: "\(name).tagsList[]")
            }
            try self.validate(self.tagsList, name: "tagsList", parent: name, max: 200)
            try self.widgets?.forEach {
                try $0.validate(name: "\(name).widgets[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
            case refreshSchedule = "RefreshSchedule"
            case tagsList = "TagsList"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case widgets = "Widgets"
        }
    }

    public struct CreateDashboardResponse: AWSDecodableShape {
        /// The ARN for the dashboard.
        public let dashboardArn: String?
        /// The name of the dashboard.
        public let name: String?
        /// The refresh schedule for the dashboard, if configured.
        public let refreshSchedule: RefreshSchedule?
        public let tagsList: [Tag]?
        ///  Indicates whether termination protection is enabled for the dashboard.
        public let terminationProtectionEnabled: Bool?
        /// The dashboard type.
        public let type: DashboardType?
        /// An array of widgets for the dashboard.
        public let widgets: [Widget]?

        @inlinable
        public init(dashboardArn: String? = nil, name: String? = nil, refreshSchedule: RefreshSchedule? = nil, tagsList: [Tag]? = nil, terminationProtectionEnabled: Bool? = nil, type: DashboardType? = nil, widgets: [Widget]? = nil) {
            self.dashboardArn = dashboardArn
            self.name = name
            self.refreshSchedule = refreshSchedule
            self.tagsList = tagsList
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.type = type
            self.widgets = widgets
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardArn = "DashboardArn"
            case name = "Name"
            case refreshSchedule = "RefreshSchedule"
            case tagsList = "TagsList"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case type = "Type"
            case widgets = "Widgets"
        }
    }

    public struct CreateEventDataStoreRequest: AWSEncodableShape {
        /// The advanced event selectors to use to select the events for the data store. You can configure up to five advanced event selectors for each event data store. For more information about how to use advanced event selectors to log CloudTrail events, see Log events by using advanced event selectors in the CloudTrail User Guide. For more information about how to use advanced event selectors to include Config configuration items in your event data store, see Create an event data store for Config configuration items in the CloudTrail User Guide. For more information about how to use advanced event selectors to include events outside of Amazon Web Services events in your event data store, see Create an integration to log events from outside Amazon Web Services in the CloudTrail User Guide.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store. The following are the possible values:    EXTENDABLE_RETENTION_PRICING - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years).  The default retention period for this billing mode is 366 days.    FIXED_RETENTION_PRICING - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years).  The default retention period for this billing mode is 2557 days.   The default value is EXTENDABLE_RETENTION_PRICING. For more information about CloudTrail pricing,  see CloudTrail Pricing and  Managing CloudTrail Lake costs.
        public let billingMode: BillingMode?
        /// Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.  Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.  CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide. Examples:    alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012     12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether the event data store includes events from all Regions, or only from the Region in which the event data store is created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String
        /// Specifies whether an event data store collects events logged for an organization in Organizations.
        public let organizationEnabled: Bool?
        /// The retention period of the event data store, in days. If BillingMode is set to EXTENDABLE_RETENTION_PRICING, you can set a retention period of up to 3653 days, the equivalent of 10 years. If BillingMode is set to FIXED_RETENTION_PRICING, you can set a retention period of up to 2557 days, the equivalent of seven years. CloudTrail  Lake determines whether to retain an event by checking if the eventTime  of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events  when the eventTime is older than 90 days.  If you plan to copy trail events to this event data store, we recommend  that you consider both the age of the events that you want to copy as well as how long you want to keep the copied events in your event data store. For example, if you copy trail events that are 5 years old  and specify a retention period of 7 years, the event data store  will retain those events for two years.
        public let retentionPeriod: Int?
        /// Specifies whether the event data store should start ingesting live events. The default is true.
        public let startIngestion: Bool?
        public let tagsList: [Tag]?
        /// Specifies whether termination protection is enabled for the event data store. If termination protection is enabled, you cannot delete the event data store until termination protection is disabled.
        public let terminationProtectionEnabled: Bool?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, startIngestion: Bool? = nil, tagsList: [Tag]? = nil, terminationProtectionEnabled: Bool? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.startIngestion = startIngestion
            self.tagsList = tagsList
            self.terminationProtectionEnabled = terminationProtectionEnabled
        }

        public func validate(name: String) throws {
            try self.advancedEventSelectors?.forEach {
                try $0.validate(name: "\(name).advancedEventSelectors[]")
            }
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, max: 350)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, min: 1)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.name, name: "name", parent: name, max: 128)
            try self.validate(self.name, name: "name", parent: name, min: 3)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9._\\-]+$")
            try self.validate(self.retentionPeriod, name: "retentionPeriod", parent: name, max: 3653)
            try self.validate(self.retentionPeriod, name: "retentionPeriod", parent: name, min: 7)
            try self.tagsList?.forEach {
                try $0.validate(name: "\(name).tagsList[]")
            }
            try self.validate(self.tagsList, name: "tagsList", parent: name, max: 200)
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case startIngestion = "StartIngestion"
            case tagsList = "TagsList"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
        }
    }

    public struct CreateEventDataStoreResponse: AWSDecodableShape {
        /// The advanced event selectors that were used to select the events for the data store.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The billing mode for the event data store.
        public let billingMode: BillingMode?
        /// The timestamp that shows when the event data store was created.
        public let createdTimestamp: Date?
        /// The ARN of the event data store.
        public let eventDataStoreArn: String?
        /// Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Indicates whether the event data store collects events from all Regions, or only from the Region in which it was created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String?
        /// Indicates whether an event data store is collecting logged events for an organization in Organizations.
        public let organizationEnabled: Bool?
        /// The retention period of an event data store, in days.
        public let retentionPeriod: Int?
        /// The status of event data store creation.
        public let status: EventDataStoreStatus?
        public let tagsList: [Tag]?
        /// Indicates whether termination protection is enabled for the event data store.
        public let terminationProtectionEnabled: Bool?
        /// The timestamp that shows when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.
        public let updatedTimestamp: Date?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, createdTimestamp: Date? = nil, eventDataStoreArn: String? = nil, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, status: EventDataStoreStatus? = nil, tagsList: [Tag]? = nil, terminationProtectionEnabled: Bool? = nil, updatedTimestamp: Date? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.createdTimestamp = createdTimestamp
            self.eventDataStoreArn = eventDataStoreArn
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.status = status
            self.tagsList = tagsList
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case createdTimestamp = "CreatedTimestamp"
            case eventDataStoreArn = "EventDataStoreArn"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case status = "Status"
            case tagsList = "TagsList"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct CreateTrailRequest: AWSEncodableShape {
        /// Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account. Not required unless you specify CloudWatchLogsRoleArn.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether log file integrity validation is enabled. The default is false.  When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
        public let enableLogFileValidation: Bool?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide. Examples:    alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012     12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies the name of the trail. The name must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)
        public let name: String
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files.  For information about bucket naming rules, see Bucket naming rules  in the Amazon Simple Storage Service User Guide.
        public let s3BucketName: String
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.
        public let snsTopicName: String?
        public let tagsList: [Tag]?

        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, enableLogFileValidation: Bool? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, name: String, s3BucketName: String, s3KeyPrefix: String? = nil, snsTopicName: String? = nil, tagsList: [Tag]? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.enableLogFileValidation = enableLogFileValidation
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicName = snsTopicName
            self.tagsList = tagsList
        }

        public func validate(name: String) throws {
            try self.tagsList?.forEach {
                try $0.validate(name: "\(name).tagsList[]")
            }
            try self.validate(self.tagsList, name: "tagsList", parent: name, max: 200)
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case enableLogFileValidation = "EnableLogFileValidation"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicName = "SnsTopicName"
            case tagsList = "TagsList"
        }
    }

    public struct CreateTrailResponse: AWSDecodableShape {
        /// Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists in one Region or in all Regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file integrity validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Specifies the name of the trail.
        public let name: String?
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// This field is no longer in use. Use SnsTopicARN.
        public let snsTopicName: String?
        /// Specifies the ARN of the trail that was created. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = nil
            self.trailARN = trailARN
        }

        @available(*, deprecated, message: "Members snsTopicName have been deprecated")
        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, snsTopicName: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = snsTopicName
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case snsTopicName = "SnsTopicName"
            case trailARN = "TrailARN"
        }
    }

    public struct DashboardDetail: AWSDecodableShape {
        /// The ARN for the dashboard.
        public let dashboardArn: String?
        /// The type of dashboard.
        public let type: DashboardType?

        @inlinable
        public init(dashboardArn: String? = nil, type: DashboardType? = nil) {
            self.dashboardArn = dashboardArn
            self.type = type
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardArn = "DashboardArn"
            case type = "Type"
        }
    }

    public struct DataResource: AWSEncodableShape & AWSDecodableShape {
        /// The resource type in which you want to log data events. You can specify the following basic event selector resource types:    AWS::DynamoDB::Table     AWS::Lambda::Function     AWS::S3::Object    Additional resource types are available through advanced event selectors. For more information, see AdvancedEventSelector.
        public let type: String?
        /// An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type.   To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as arn:aws:s3.  This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account.    To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::amzn-s3-demo-bucket1/. The trail logs data events for all objects in this S3 bucket.   To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::amzn-s3-demo-bucket1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.   To log data events for all Lambda functions in your Amazon Web Services account, specify the prefix as arn:aws:lambda.  This also enables logging of Invoke activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account.     To log data events for a specific Lambda function, specify the function ARN.  Lambda function ARNs are exact. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.    To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as arn:aws:dynamodb.
        public let values: [String]?

        @inlinable
        public init(type: String? = nil, values: [String]? = nil) {
            self.type = type
            self.values = values
        }

        private enum CodingKeys: String, CodingKey {
            case type = "Type"
            case values = "Values"
        }
    }

    public struct DeleteChannelRequest: AWSEncodableShape {
        /// The ARN or the UUID value of the channel that you want to delete.
        public let channel: String

        @inlinable
        public init(channel: String) {
            self.channel = channel
        }

        public func validate(name: String) throws {
            try self.validate(self.channel, name: "channel", parent: name, max: 256)
            try self.validate(self.channel, name: "channel", parent: name, min: 3)
            try self.validate(self.channel, name: "channel", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case channel = "Channel"
        }
    }

    public struct DeleteChannelResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteDashboardRequest: AWSEncodableShape {
        /// The name or ARN for the dashboard.
        public let dashboardId: String

        @inlinable
        public init(dashboardId: String) {
            self.dashboardId = dashboardId
        }

        public func validate(name: String) throws {
            try self.validate(self.dashboardId, name: "dashboardId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardId = "DashboardId"
        }
    }

    public struct DeleteDashboardResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteEventDataStoreRequest: AWSEncodableShape {
        /// The ARN (or the ID suffix of the ARN) of the event data store to delete.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct DeleteEventDataStoreResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteResourcePolicyRequest: AWSEncodableShape {
        ///  The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel you're deleting the resource-based policy from. Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceArn: String

        @inlinable
        public init(resourceArn: String) {
            self.resourceArn = resourceArn
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 256)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 3)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn = "ResourceArn"
        }
    }

    public struct DeleteResourcePolicyResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteTrailRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail to be deleted. The following is the format of a trail ARN. arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct DeleteTrailResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeregisterOrganizationDelegatedAdminRequest: AWSEncodableShape {
        /// A delegated administrator account ID. This is a member account in an organization that is currently designated as a delegated administrator.
        public let delegatedAdminAccountId: String

        @inlinable
        public init(delegatedAdminAccountId: String) {
            self.delegatedAdminAccountId = delegatedAdminAccountId
        }

        public func validate(name: String) throws {
            try self.validate(self.delegatedAdminAccountId, name: "delegatedAdminAccountId", parent: name, max: 16)
            try self.validate(self.delegatedAdminAccountId, name: "delegatedAdminAccountId", parent: name, min: 12)
            try self.validate(self.delegatedAdminAccountId, name: "delegatedAdminAccountId", parent: name, pattern: "^\\d+$")
        }

        private enum CodingKeys: String, CodingKey {
            case delegatedAdminAccountId = "DelegatedAdminAccountId"
        }
    }

    public struct DeregisterOrganizationDelegatedAdminResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DescribeQueryRequest: AWSEncodableShape {
        /// The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.
        public let eventDataStore: String?
        /// The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        ///  The alias that identifies a query template.
        public let queryAlias: String?
        /// The query ID.
        public let queryId: String?
        /// The ID of the dashboard refresh.
        public let refreshId: String?

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, queryAlias: String? = nil, queryId: String? = nil, refreshId: String? = nil) {
            self.eventDataStore = nil
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryAlias = queryAlias
            self.queryId = queryId
            self.refreshId = refreshId
        }

        @available(*, deprecated, message: "Members eventDataStore have been deprecated")
        @inlinable
        public init(eventDataStore: String? = nil, eventDataStoreOwnerAccountId: String? = nil, queryAlias: String? = nil, queryId: String? = nil, refreshId: String? = nil) {
            self.eventDataStore = eventDataStore
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryAlias = queryAlias
            self.queryId = queryId
            self.refreshId = refreshId
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, max: 16)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, min: 12)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, pattern: "^\\d+$")
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, max: 256)
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, min: 1)
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, pattern: "^[a-zA-Z][a-zA-Z0-9._\\-]*$")
            try self.validate(self.queryId, name: "queryId", parent: name, max: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, min: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, pattern: "^[a-f0-9\\-]+$")
            try self.validate(self.refreshId, name: "refreshId", parent: name, max: 20)
            try self.validate(self.refreshId, name: "refreshId", parent: name, min: 10)
            try self.validate(self.refreshId, name: "refreshId", parent: name, pattern: "^\\d+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryAlias = "QueryAlias"
            case queryId = "QueryId"
            case refreshId = "RefreshId"
        }
    }

    public struct DescribeQueryResponse: AWSDecodableShape {
        /// The URI for the S3 bucket where CloudTrail delivered query results, if applicable.
        public let deliveryS3Uri: String?
        /// The delivery status.
        public let deliveryStatus: DeliveryStatus?
        /// The error message returned if a query failed.
        public let errorMessage: String?
        ///  The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        ///  The prompt used for a generated query. For information about generated queries, see  Create CloudTrail Lake queries from natural language prompts  in the CloudTrail  user guide.
        public let prompt: String?
        /// The ID of the query.
        public let queryId: String?
        /// Metadata about a query, including the number of events that were matched, the total number of events scanned, the query run time in milliseconds, and the query's creation time.
        public let queryStatistics: QueryStatisticsForDescribeQuery?
        /// The status of a query. Values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED
        public let queryStatus: QueryStatus?
        /// The SQL code of a query.
        public let queryString: String?

        @inlinable
        public init(deliveryS3Uri: String? = nil, deliveryStatus: DeliveryStatus? = nil, errorMessage: String? = nil, eventDataStoreOwnerAccountId: String? = nil, prompt: String? = nil, queryId: String? = nil, queryStatistics: QueryStatisticsForDescribeQuery? = nil, queryStatus: QueryStatus? = nil, queryString: String? = nil) {
            self.deliveryS3Uri = deliveryS3Uri
            self.deliveryStatus = deliveryStatus
            self.errorMessage = errorMessage
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.prompt = prompt
            self.queryId = queryId
            self.queryStatistics = queryStatistics
            self.queryStatus = queryStatus
            self.queryString = queryString
        }

        private enum CodingKeys: String, CodingKey {
            case deliveryS3Uri = "DeliveryS3Uri"
            case deliveryStatus = "DeliveryStatus"
            case errorMessage = "ErrorMessage"
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case prompt = "Prompt"
            case queryId = "QueryId"
            case queryStatistics = "QueryStatistics"
            case queryStatus = "QueryStatus"
            case queryString = "QueryString"
        }
    }

    public struct DescribeTrailsRequest: AWSEncodableShape {
        /// Specifies whether to include shadow trails in the response. A shadow trail is the replication in a Region of a trail that was created in a different Region, or in the case of an organization trail, the replication of an organization trail in member accounts. If you do not include shadow trails, organization trails in a member account and Region replication trails will not be returned. The default is true.
        public let includeShadowTrails: Bool?
        /// Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  If an empty list is specified, information for the trail in the current Region is returned.   If an empty list is specified and IncludeShadowTrails is false, then information for all trails in the current Region is returned.   If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current Region and any associated shadow trails in other Regions is returned.    If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current Region and current account. To return information about a trail in another Region, you must specify its trail ARN.
        public let trailNameList: [String]?

        @inlinable
        public init(includeShadowTrails: Bool? = nil, trailNameList: [String]? = nil) {
            self.includeShadowTrails = includeShadowTrails
            self.trailNameList = trailNameList
        }

        private enum CodingKeys: String, CodingKey {
            case includeShadowTrails = "includeShadowTrails"
            case trailNameList = "trailNameList"
        }
    }

    public struct DescribeTrailsResponse: AWSDecodableShape {
        /// The list of trail objects. Trail objects with string values are only returned if values for the objects exist in a trail's configuration. For example, SNSTopicName and SNSTopicARN are only returned in results if a trail is configured to send SNS notifications. Similarly, KMSKeyId only appears in results if a trail's log files are encrypted with KMS customer managed keys.
        public let trailList: [Trail]?

        @inlinable
        public init(trailList: [Trail]? = nil) {
            self.trailList = trailList
        }

        private enum CodingKeys: String, CodingKey {
            case trailList = "trailList"
        }
    }

    public struct Destination: AWSEncodableShape & AWSDecodableShape {
        ///  For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel.  For service-linked channels, the location is the name of the Amazon Web Services service.
        public let location: String
        /// The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is EVENT_DATA_STORE. For service-linked channels,  the value is AWS_SERVICE.
        public let type: DestinationType

        @inlinable
        public init(location: String, type: DestinationType) {
            self.location = location
            self.type = type
        }

        public func validate(name: String) throws {
            try self.validate(self.location, name: "location", parent: name, max: 1024)
            try self.validate(self.location, name: "location", parent: name, min: 3)
            try self.validate(self.location, name: "location", parent: name, pattern: "^[a-zA-Z0-9._/\\-:*]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case location = "Location"
            case type = "Type"
        }
    }

    public struct DisableFederationRequest: AWSEncodableShape {
        ///  The ARN (or ID suffix of the ARN) of the event data store for which you want to disable Lake query federation.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct DisableFederationResponse: AWSDecodableShape {
        ///  The ARN of the event data store for which you disabled Lake query federation.
        public let eventDataStoreArn: String?
        ///  The federation status.
        public let federationStatus: FederationStatus?

        @inlinable
        public init(eventDataStoreArn: String? = nil, federationStatus: FederationStatus? = nil) {
            self.eventDataStoreArn = eventDataStoreArn
            self.federationStatus = federationStatus
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreArn = "EventDataStoreArn"
            case federationStatus = "FederationStatus"
        }
    }

    public struct EnableFederationRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the event data store for which you want to enable Lake query federation.
        public let eventDataStore: String
        ///  The ARN of the federation role to use for the event data store. Amazon Web Services services like Lake Formation use this federation role to access data for the federated event  data store. The federation role must exist in your account and provide the required minimum permissions.
        public let federationRoleArn: String

        @inlinable
        public init(eventDataStore: String, federationRoleArn: String) {
            self.eventDataStore = eventDataStore
            self.federationRoleArn = federationRoleArn
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.federationRoleArn, name: "federationRoleArn", parent: name, max: 125)
            try self.validate(self.federationRoleArn, name: "federationRoleArn", parent: name, min: 3)
            try self.validate(self.federationRoleArn, name: "federationRoleArn", parent: name, pattern: "^[a-zA-Z0-9._/\\-:@=\\+,\\.]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case federationRoleArn = "FederationRoleArn"
        }
    }

    public struct EnableFederationResponse: AWSDecodableShape {
        ///  The ARN of the event data store for which you enabled Lake query federation.
        public let eventDataStoreArn: String?
        ///  The ARN of the federation role.
        public let federationRoleArn: String?
        ///  The federation status.
        public let federationStatus: FederationStatus?

        @inlinable
        public init(eventDataStoreArn: String? = nil, federationRoleArn: String? = nil, federationStatus: FederationStatus? = nil) {
            self.eventDataStoreArn = eventDataStoreArn
            self.federationRoleArn = federationRoleArn
            self.federationStatus = federationStatus
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreArn = "EventDataStoreArn"
            case federationRoleArn = "FederationRoleArn"
            case federationStatus = "FederationStatus"
        }
    }

    public struct Event: AWSDecodableShape {
        /// The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.
        public let accessKeyId: String?
        /// A JSON string that contains a representation of the event returned.
        public let cloudTrailEvent: String?
        /// The CloudTrail ID of the event returned.
        public let eventId: String?
        /// The name of the event returned.
        public let eventName: String?
        /// The Amazon Web Services service to which the request was made.
        public let eventSource: String?
        /// The date and time of the event returned.
        public let eventTime: Date?
        /// Information about whether the event is a write event or a read event.
        public let readOnly: String?
        /// A list of resources referenced by the event returned.
        public let resources: [Resource]?
        /// A user name or role name of the requester that called the API in the event returned.
        public let username: String?

        @inlinable
        public init(accessKeyId: String? = nil, cloudTrailEvent: String? = nil, eventId: String? = nil, eventName: String? = nil, eventSource: String? = nil, eventTime: Date? = nil, readOnly: String? = nil, resources: [Resource]? = nil, username: String? = nil) {
            self.accessKeyId = accessKeyId
            self.cloudTrailEvent = cloudTrailEvent
            self.eventId = eventId
            self.eventName = eventName
            self.eventSource = eventSource
            self.eventTime = eventTime
            self.readOnly = readOnly
            self.resources = resources
            self.username = username
        }

        private enum CodingKeys: String, CodingKey {
            case accessKeyId = "AccessKeyId"
            case cloudTrailEvent = "CloudTrailEvent"
            case eventId = "EventId"
            case eventName = "EventName"
            case eventSource = "EventSource"
            case eventTime = "EventTime"
            case readOnly = "ReadOnly"
            case resources = "Resources"
            case username = "Username"
        }
    }

    public struct EventDataStore: AWSDecodableShape {
        /// The advanced event selectors that were used to select events for the data store.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The timestamp of the event data store's creation.
        public let createdTimestamp: Date?
        /// The ARN of the event data store.
        public let eventDataStoreArn: String?
        /// Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String?
        /// Indicates that an event data store is collecting logged events for an organization.
        public let organizationEnabled: Bool?
        /// The retention period, in days.
        public let retentionPeriod: Int?
        /// The status of an event data store.
        public let status: EventDataStoreStatus?
        /// Indicates whether the event data store is protected from termination.
        public let terminationProtectionEnabled: Bool?
        /// The timestamp showing when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.
        public let updatedTimestamp: Date?

        @inlinable
        public init(eventDataStoreArn: String? = nil, name: String? = nil) {
            self.advancedEventSelectors = nil
            self.createdTimestamp = nil
            self.eventDataStoreArn = eventDataStoreArn
            self.multiRegionEnabled = nil
            self.name = name
            self.organizationEnabled = nil
            self.retentionPeriod = nil
            self.status = nil
            self.terminationProtectionEnabled = nil
            self.updatedTimestamp = nil
        }

        @available(*, deprecated, message: "Members advancedEventSelectors, createdTimestamp, multiRegionEnabled, organizationEnabled, retentionPeriod, status, terminationProtectionEnabled, updatedTimestamp have been deprecated")
        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, createdTimestamp: Date? = nil, eventDataStoreArn: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, status: EventDataStoreStatus? = nil, terminationProtectionEnabled: Bool? = nil, updatedTimestamp: Date? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.createdTimestamp = createdTimestamp
            self.eventDataStoreArn = eventDataStoreArn
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.status = status
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case createdTimestamp = "CreatedTimestamp"
            case eventDataStoreArn = "EventDataStoreArn"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case status = "Status"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct EventSelector: AWSEncodableShape & AWSDecodableShape {
        /// CloudTrail supports data event logging for Amazon S3 objects in standard S3 buckets, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events. For more information, see Data Events and Limits in CloudTrail in the CloudTrail User Guide.  To log data events for all other resource types including objects stored in  directory buckets, you must use AdvancedEventSelectors. You must also  use AdvancedEventSelectors if you want to filter on the eventName field.
        public let dataResources: [DataResource]?
        /// An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing kms.amazonaws.com or rdsdata.amazonaws.com. By default, ExcludeManagementEventSources is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source.
        public let excludeManagementEventSources: [String]?
        /// Specify if you want your event selector to include management events for your trail. For more information, see Management Events in the CloudTrail User Guide. By default, the value is true. The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing.
        public let includeManagementEvents: Bool?
        /// Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 GetConsoleOutput is a read-only API operation and RunInstances is a write-only API operation. By default, the value is All.
        public let readWriteType: ReadWriteType?

        @inlinable
        public init(dataResources: [DataResource]? = nil, excludeManagementEventSources: [String]? = nil, includeManagementEvents: Bool? = nil, readWriteType: ReadWriteType? = nil) {
            self.dataResources = dataResources
            self.excludeManagementEventSources = excludeManagementEventSources
            self.includeManagementEvents = includeManagementEvents
            self.readWriteType = readWriteType
        }

        private enum CodingKeys: String, CodingKey {
            case dataResources = "DataResources"
            case excludeManagementEventSources = "ExcludeManagementEventSources"
            case includeManagementEvents = "IncludeManagementEvents"
            case readWriteType = "ReadWriteType"
        }
    }

    public struct GenerateQueryRequest: AWSEncodableShape {
        ///  The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store.
        public let eventDataStores: [String]
        ///  The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see  Example prompts  in the CloudTrail  user guide.
        public let prompt: String

        @inlinable
        public init(eventDataStores: [String], prompt: String) {
            self.eventDataStores = eventDataStores
            self.prompt = prompt
        }

        public func validate(name: String) throws {
            try self.eventDataStores.forEach {
                try validate($0, name: "eventDataStores[]", parent: name, max: 256)
                try validate($0, name: "eventDataStores[]", parent: name, min: 3)
                try validate($0, name: "eventDataStores[]", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            }
            try self.validate(self.eventDataStores, name: "eventDataStores", parent: name, max: 1)
            try self.validate(self.eventDataStores, name: "eventDataStores", parent: name, min: 1)
            try self.validate(self.prompt, name: "prompt", parent: name, max: 500)
            try self.validate(self.prompt, name: "prompt", parent: name, min: 3)
            try self.validate(self.prompt, name: "prompt", parent: name, pattern: "^[ -~\\n]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStores = "EventDataStores"
            case prompt = "Prompt"
        }
    }

    public struct GenerateQueryResponse: AWSDecodableShape {
        ///  The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        ///  An alias that identifies the prompt. When you run the StartQuery operation, you can pass in either the QueryAlias or  QueryStatement parameter.
        public let queryAlias: String?
        ///  The SQL query statement generated from the prompt.
        public let queryStatement: String?

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, queryAlias: String? = nil, queryStatement: String? = nil) {
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryAlias = queryAlias
            self.queryStatement = queryStatement
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryAlias = "QueryAlias"
            case queryStatement = "QueryStatement"
        }
    }

    public struct GetChannelRequest: AWSEncodableShape {
        /// The ARN or UUID of a channel.
        public let channel: String

        @inlinable
        public init(channel: String) {
            self.channel = channel
        }

        public func validate(name: String) throws {
            try self.validate(self.channel, name: "channel", parent: name, max: 256)
            try self.validate(self.channel, name: "channel", parent: name, min: 3)
            try self.validate(self.channel, name: "channel", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case channel = "Channel"
        }
    }

    public struct GetChannelResponse: AWSDecodableShape {
        /// The ARN of an channel returned by a GetChannel request.
        public let channelArn: String?
        /// The destinations for the channel. For channels created for integrations,  the destinations are the event data stores that log events arriving through the channel.  For service-linked channels, the destination is the Amazon Web Services service that created the service-linked channel to receive events.
        public let destinations: [Destination]?
        /// A table showing information about the most recent successful and failed attempts  to ingest events.
        public let ingestionStatus: IngestionStatus?
        ///  The name of the CloudTrail channel. For service-linked channels, the name is aws-service-channel/service-name/custom-suffix where service-name represents the name of the Amazon Web Services service that created the channel and custom-suffix represents the suffix generated by the Amazon Web Services service.
        public let name: String?
        /// The source for the CloudTrail channel.
        public let source: String?
        ///  Provides information about the advanced event selectors configured for the channel, and whether the channel applies to all Regions or a single Region.
        public let sourceConfig: SourceConfig?

        @inlinable
        public init(channelArn: String? = nil, destinations: [Destination]? = nil, ingestionStatus: IngestionStatus? = nil, name: String? = nil, source: String? = nil, sourceConfig: SourceConfig? = nil) {
            self.channelArn = channelArn
            self.destinations = destinations
            self.ingestionStatus = ingestionStatus
            self.name = name
            self.source = source
            self.sourceConfig = sourceConfig
        }

        private enum CodingKeys: String, CodingKey {
            case channelArn = "ChannelArn"
            case destinations = "Destinations"
            case ingestionStatus = "IngestionStatus"
            case name = "Name"
            case source = "Source"
            case sourceConfig = "SourceConfig"
        }
    }

    public struct GetDashboardRequest: AWSEncodableShape {
        /// The name or ARN for the dashboard.
        public let dashboardId: String

        @inlinable
        public init(dashboardId: String) {
            self.dashboardId = dashboardId
        }

        public func validate(name: String) throws {
            try self.validate(self.dashboardId, name: "dashboardId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardId = "DashboardId"
        }
    }

    public struct GetDashboardResponse: AWSDecodableShape {
        ///  The timestamp that shows when the dashboard was created.
        public let createdTimestamp: Date?
        ///  The ARN for the dashboard.
        public let dashboardArn: String?
        /// Provides information about failures for the last scheduled refresh.
        public let lastRefreshFailureReason: String?
        /// The ID of the last dashboard refresh.
        public let lastRefreshId: String?
        /// The refresh schedule for the dashboard, if configured.
        public let refreshSchedule: RefreshSchedule?
        /// The status of the dashboard.
        public let status: DashboardStatus?
        /// Indicates whether termination protection is enabled for the dashboard.
        public let terminationProtectionEnabled: Bool?
        /// The type of dashboard.
        public let type: DashboardType?
        ///  The timestamp that shows when the dashboard was last updated.
        public let updatedTimestamp: Date?
        /// An array of widgets for the dashboard.
        public let widgets: [Widget]?

        @inlinable
        public init(createdTimestamp: Date? = nil, dashboardArn: String? = nil, lastRefreshFailureReason: String? = nil, lastRefreshId: String? = nil, refreshSchedule: RefreshSchedule? = nil, status: DashboardStatus? = nil, terminationProtectionEnabled: Bool? = nil, type: DashboardType? = nil, updatedTimestamp: Date? = nil, widgets: [Widget]? = nil) {
            self.createdTimestamp = createdTimestamp
            self.dashboardArn = dashboardArn
            self.lastRefreshFailureReason = lastRefreshFailureReason
            self.lastRefreshId = lastRefreshId
            self.refreshSchedule = refreshSchedule
            self.status = status
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.type = type
            self.updatedTimestamp = updatedTimestamp
            self.widgets = widgets
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case dashboardArn = "DashboardArn"
            case lastRefreshFailureReason = "LastRefreshFailureReason"
            case lastRefreshId = "LastRefreshId"
            case refreshSchedule = "RefreshSchedule"
            case status = "Status"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case type = "Type"
            case updatedTimestamp = "UpdatedTimestamp"
            case widgets = "Widgets"
        }
    }

    public struct GetEventConfigurationRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which you want to retrieve event configuration settings.
        public let eventDataStore: String?

        @inlinable
        public init(eventDataStore: String? = nil) {
            self.eventDataStore = eventDataStore
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct GetEventConfigurationResponse: AWSDecodableShape {
        /// The list of context key selectors that are configured for the event data store.
        public let contextKeySelectors: [ContextKeySelector]?
        /// The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which the event configuration settings are returned.
        public let eventDataStoreArn: String?
        /// The maximum allowed size for events stored in the specified event data store.
        public let maxEventSize: MaxEventSize?

        @inlinable
        public init(contextKeySelectors: [ContextKeySelector]? = nil, eventDataStoreArn: String? = nil, maxEventSize: MaxEventSize? = nil) {
            self.contextKeySelectors = contextKeySelectors
            self.eventDataStoreArn = eventDataStoreArn
            self.maxEventSize = maxEventSize
        }

        private enum CodingKeys: String, CodingKey {
            case contextKeySelectors = "ContextKeySelectors"
            case eventDataStoreArn = "EventDataStoreArn"
            case maxEventSize = "MaxEventSize"
        }
    }

    public struct GetEventDataStoreRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the event data store about which you want information.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct GetEventDataStoreResponse: AWSDecodableShape {
        /// The advanced event selectors used to select events for the data store.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The billing mode for the event data store.
        public let billingMode: BillingMode?
        /// The timestamp of the event data store's creation.
        public let createdTimestamp: Date?
        /// The event data store Amazon Resource Number (ARN).
        public let eventDataStoreArn: String?
        ///  If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store.
        public let federationRoleArn: String?
        ///  Indicates the Lake query federation status. The status is  ENABLED if Lake query federation is enabled, or DISABLED if Lake query federation is disabled. You cannot delete an event data store if the FederationStatus is ENABLED.
        public let federationStatus: FederationStatus?
        /// Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String?
        /// Indicates whether an event data store is collecting logged events for an organization in Organizations.
        public let organizationEnabled: Bool?
        /// The partition keys for the event data store. To improve query performance and efficiency, CloudTrail Lake organizes  event data into partitions based on values derived from partition keys.
        public let partitionKeys: [PartitionKey]?
        /// The retention period of the event data store, in days.
        public let retentionPeriod: Int?
        /// The status of an event data store.
        public let status: EventDataStoreStatus?
        /// Indicates that termination protection is enabled.
        public let terminationProtectionEnabled: Bool?
        /// Shows the time that an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.
        public let updatedTimestamp: Date?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, createdTimestamp: Date? = nil, eventDataStoreArn: String? = nil, federationRoleArn: String? = nil, federationStatus: FederationStatus? = nil, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, partitionKeys: [PartitionKey]? = nil, retentionPeriod: Int? = nil, status: EventDataStoreStatus? = nil, terminationProtectionEnabled: Bool? = nil, updatedTimestamp: Date? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.createdTimestamp = createdTimestamp
            self.eventDataStoreArn = eventDataStoreArn
            self.federationRoleArn = federationRoleArn
            self.federationStatus = federationStatus
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.partitionKeys = partitionKeys
            self.retentionPeriod = retentionPeriod
            self.status = status
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case createdTimestamp = "CreatedTimestamp"
            case eventDataStoreArn = "EventDataStoreArn"
            case federationRoleArn = "FederationRoleArn"
            case federationStatus = "FederationStatus"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case partitionKeys = "PartitionKeys"
            case retentionPeriod = "RetentionPeriod"
            case status = "Status"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct GetEventSelectorsRequest: AWSEncodableShape {
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailName: String

        @inlinable
        public init(trailName: String) {
            self.trailName = trailName
        }

        private enum CodingKeys: String, CodingKey {
            case trailName = "TrailName"
        }
    }

    public struct GetEventSelectorsResponse: AWSDecodableShape {
        ///  The advanced event selectors that are configured for the trail.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The event selectors that are configured for the trail.
        public let eventSelectors: [EventSelector]?
        /// The specified trail ARN that has the event selectors.
        public let trailARN: String?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailARN: String? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct GetImportRequest: AWSEncodableShape {
        ///  The ID for the import.
        public let importId: String

        @inlinable
        public init(importId: String) {
            self.importId = importId
        }

        public func validate(name: String) throws {
            try self.validate(self.importId, name: "importId", parent: name, max: 36)
            try self.validate(self.importId, name: "importId", parent: name, min: 36)
            try self.validate(self.importId, name: "importId", parent: name, pattern: "^[a-f0-9\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case importId = "ImportId"
        }
    }

    public struct GetImportResponse: AWSDecodableShape {
        ///  The timestamp of the import's creation.
        public let createdTimestamp: Date?
        ///  The ARN of the destination event data store.
        public let destinations: [String]?
        ///  Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let endEventTime: Date?
        ///  The ID of the import.
        public let importId: String?
        ///  The source S3 bucket.
        public let importSource: ImportSource?
        ///  Provides statistics for the import. CloudTrail does not update import statistics in real-time. Returned values for parameters such as EventsCompleted may be lower than the actual value, because CloudTrail updates statistics incrementally over the course of the import.
        public let importStatistics: ImportStatistics?
        ///  The status of the import.
        public let importStatus: ImportStatus?
        ///  Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let startEventTime: Date?
        ///  The timestamp of when the import was updated.
        public let updatedTimestamp: Date?

        @inlinable
        public init(createdTimestamp: Date? = nil, destinations: [String]? = nil, endEventTime: Date? = nil, importId: String? = nil, importSource: ImportSource? = nil, importStatistics: ImportStatistics? = nil, importStatus: ImportStatus? = nil, startEventTime: Date? = nil, updatedTimestamp: Date? = nil) {
            self.createdTimestamp = createdTimestamp
            self.destinations = destinations
            self.endEventTime = endEventTime
            self.importId = importId
            self.importSource = importSource
            self.importStatistics = importStatistics
            self.importStatus = importStatus
            self.startEventTime = startEventTime
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case destinations = "Destinations"
            case endEventTime = "EndEventTime"
            case importId = "ImportId"
            case importSource = "ImportSource"
            case importStatistics = "ImportStatistics"
            case importStatus = "ImportStatus"
            case startEventTime = "StartEventTime"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct GetInsightSelectorsRequest: AWSEncodableShape {
        ///  Specifies the ARN (or ID suffix of the ARN) of the event data store for which you want to get Insights selectors.  You cannot use this parameter with the TrailName parameter.
        public let eventDataStore: String?
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  You cannot use this parameter with the EventDataStore parameter.
        public let trailName: String?

        @inlinable
        public init(eventDataStore: String? = nil, trailName: String? = nil) {
            self.eventDataStore = eventDataStore
            self.trailName = trailName
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case trailName = "TrailName"
        }
    }

    public struct GetInsightSelectorsResponse: AWSDecodableShape {
        ///  The ARN of the source event data store that enabled Insights events.
        public let eventDataStoreArn: String?
        ///  The ARN of the destination event data store that logs Insights events.
        public let insightsDestination: String?
        /// A JSON string that contains the Insight types you want to log on a trail or event data store. ApiErrorRateInsight and ApiCallRateInsight are supported as Insights types.
        public let insightSelectors: [InsightSelector]?
        /// The Amazon Resource Name (ARN) of a trail for which you want to get Insights selectors.
        public let trailARN: String?

        @inlinable
        public init(eventDataStoreArn: String? = nil, insightsDestination: String? = nil, insightSelectors: [InsightSelector]? = nil, trailARN: String? = nil) {
            self.eventDataStoreArn = eventDataStoreArn
            self.insightsDestination = insightsDestination
            self.insightSelectors = insightSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreArn = "EventDataStoreArn"
            case insightsDestination = "InsightsDestination"
            case insightSelectors = "InsightSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct GetQueryResultsRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the event data store against which the query was run.
        public let eventDataStore: String?
        /// The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        /// The maximum number of query results to display on a single page.
        public let maxQueryResults: Int?
        /// A token you can use to get the next page of query results.
        public let nextToken: String?
        /// The ID of the query for which you want to get results.
        public let queryId: String

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, maxQueryResults: Int? = nil, nextToken: String? = nil, queryId: String) {
            self.eventDataStore = nil
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.maxQueryResults = maxQueryResults
            self.nextToken = nextToken
            self.queryId = queryId
        }

        @available(*, deprecated, message: "Members eventDataStore have been deprecated")
        @inlinable
        public init(eventDataStore: String? = nil, eventDataStoreOwnerAccountId: String? = nil, maxQueryResults: Int? = nil, nextToken: String? = nil, queryId: String) {
            self.eventDataStore = eventDataStore
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.maxQueryResults = maxQueryResults
            self.nextToken = nextToken
            self.queryId = queryId
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, max: 16)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, min: 12)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, pattern: "^\\d+$")
            try self.validate(self.maxQueryResults, name: "maxQueryResults", parent: name, max: 1000)
            try self.validate(self.maxQueryResults, name: "maxQueryResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
            try self.validate(self.queryId, name: "queryId", parent: name, max: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, min: 36)
            try self.validate(self.queryId, name: "queryId", parent: name, pattern: "^[a-f0-9\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case maxQueryResults = "MaxQueryResults"
            case nextToken = "NextToken"
            case queryId = "QueryId"
        }
    }

    public struct GetQueryResultsResponse: AWSDecodableShape {
        /// The error message returned if a query failed.
        public let errorMessage: String?
        /// A token you can use to get the next page of query results.
        public let nextToken: String?
        /// Contains the individual event results of the query.
        public let queryResultRows: [[[String: String]]]?
        /// Shows the count of query results.
        public let queryStatistics: QueryStatistics?
        /// The status of the query. Values include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.
        public let queryStatus: QueryStatus?

        @inlinable
        public init(errorMessage: String? = nil, nextToken: String? = nil, queryResultRows: [[[String: String]]]? = nil, queryStatistics: QueryStatistics? = nil, queryStatus: QueryStatus? = nil) {
            self.errorMessage = errorMessage
            self.nextToken = nextToken
            self.queryResultRows = queryResultRows
            self.queryStatistics = queryStatistics
            self.queryStatus = queryStatus
        }

        private enum CodingKeys: String, CodingKey {
            case errorMessage = "ErrorMessage"
            case nextToken = "NextToken"
            case queryResultRows = "QueryResultRows"
            case queryStatistics = "QueryStatistics"
            case queryStatus = "QueryStatus"
        }
    }

    public struct GetResourcePolicyRequest: AWSEncodableShape {
        ///  The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy. Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceArn: String

        @inlinable
        public init(resourceArn: String) {
            self.resourceArn = resourceArn
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 256)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 3)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn = "ResourceArn"
        }
    }

    public struct GetResourcePolicyResponse: AWSDecodableShape {
        ///  The default resource-based policy that is automatically generated for the delegated administrator of an Organizations organization.  This policy will be evaluated in tandem with any policy you submit for the resource. For more information about this policy,  see Default resource policy for delegated administrators.
        public let delegatedAdminResourcePolicy: String?
        ///  The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to resource-based policy.   Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceArn: String?
        ///  A JSON-formatted string that contains the resource-based policy attached to the CloudTrail event data store, dashboard, or channel.
        public let resourcePolicy: String?

        @inlinable
        public init(delegatedAdminResourcePolicy: String? = nil, resourceArn: String? = nil, resourcePolicy: String? = nil) {
            self.delegatedAdminResourcePolicy = delegatedAdminResourcePolicy
            self.resourceArn = resourceArn
            self.resourcePolicy = resourcePolicy
        }

        private enum CodingKeys: String, CodingKey {
            case delegatedAdminResourcePolicy = "DelegatedAdminResourcePolicy"
            case resourceArn = "ResourceArn"
            case resourcePolicy = "ResourcePolicy"
        }
    }

    public struct GetTrailRequest: AWSEncodableShape {
        /// The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information.
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct GetTrailResponse: AWSDecodableShape {
        public let trail: Trail?

        @inlinable
        public init(trail: Trail? = nil) {
            self.trail = trail
        }

        private enum CodingKeys: String, CodingKey {
            case trail = "Trail"
        }
    }

    public struct GetTrailStatusRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which you are requesting status. To get the status of a shadow trail (a replication of the trail in another Region), you must specify its ARN.  The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail   If the trail is an organization trail and you are a member account in the organization in Organizations, you must provide the full ARN of that trail, and not just the name.
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct GetTrailStatusResponse: AWSDecodableShape {
        /// Whether the CloudTrail trail is currently logging Amazon Web Services API calls.
        public let isLogging: Bool?
        /// Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs.
        public let latestCloudWatchLogsDeliveryError: String?
        /// Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs.
        public let latestCloudWatchLogsDeliveryTime: Date?
        /// This field is no longer in use.
        public let latestDeliveryAttemptSucceeded: String?
        /// This field is no longer in use.
        public let latestDeliveryAttemptTime: String?
        /// Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver log files to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference.   This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue,  fix the bucket policy so that CloudTrail  can write to the bucket; or create a new bucket and call UpdateTrail to specify the new bucket.
        public let latestDeliveryError: String?
        /// Specifies the date and time that CloudTrail last delivered log files to an account's Amazon S3 bucket.
        public let latestDeliveryTime: Date?
        /// Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver a digest file to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference.   This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue,  fix the bucket policy so that CloudTrail  can write to the bucket; or create a new bucket and call UpdateTrail to specify the new bucket.
        public let latestDigestDeliveryError: String?
        /// Specifies the date and time that CloudTrail last delivered a digest file to an account's Amazon S3 bucket.
        public let latestDigestDeliveryTime: Date?
        /// This field is no longer in use.
        public let latestNotificationAttemptSucceeded: String?
        /// This field is no longer in use.
        public let latestNotificationAttemptTime: String?
        /// Displays any Amazon SNS error that CloudTrail encountered when attempting to send a notification. For more information about Amazon SNS errors, see the Amazon SNS Developer Guide.
        public let latestNotificationError: String?
        /// Specifies the date and time of the most recent Amazon SNS notification that CloudTrail has written a new log file to an account's Amazon S3 bucket.
        public let latestNotificationTime: Date?
        /// Specifies the most recent date and time when CloudTrail started recording API calls for an Amazon Web Services account.
        public let startLoggingTime: Date?
        /// Specifies the most recent date and time when CloudTrail stopped recording API calls for an Amazon Web Services account.
        public let stopLoggingTime: Date?
        /// This field is no longer in use.
        public let timeLoggingStarted: String?
        /// This field is no longer in use.
        public let timeLoggingStopped: String?

        @inlinable
        public init(isLogging: Bool? = nil, latestCloudWatchLogsDeliveryError: String? = nil, latestCloudWatchLogsDeliveryTime: Date? = nil, latestDeliveryAttemptSucceeded: String? = nil, latestDeliveryAttemptTime: String? = nil, latestDeliveryError: String? = nil, latestDeliveryTime: Date? = nil, latestDigestDeliveryError: String? = nil, latestDigestDeliveryTime: Date? = nil, latestNotificationAttemptSucceeded: String? = nil, latestNotificationAttemptTime: String? = nil, latestNotificationError: String? = nil, latestNotificationTime: Date? = nil, startLoggingTime: Date? = nil, stopLoggingTime: Date? = nil, timeLoggingStarted: String? = nil, timeLoggingStopped: String? = nil) {
            self.isLogging = isLogging
            self.latestCloudWatchLogsDeliveryError = latestCloudWatchLogsDeliveryError
            self.latestCloudWatchLogsDeliveryTime = latestCloudWatchLogsDeliveryTime
            self.latestDeliveryAttemptSucceeded = latestDeliveryAttemptSucceeded
            self.latestDeliveryAttemptTime = latestDeliveryAttemptTime
            self.latestDeliveryError = latestDeliveryError
            self.latestDeliveryTime = latestDeliveryTime
            self.latestDigestDeliveryError = latestDigestDeliveryError
            self.latestDigestDeliveryTime = latestDigestDeliveryTime
            self.latestNotificationAttemptSucceeded = latestNotificationAttemptSucceeded
            self.latestNotificationAttemptTime = latestNotificationAttemptTime
            self.latestNotificationError = latestNotificationError
            self.latestNotificationTime = latestNotificationTime
            self.startLoggingTime = startLoggingTime
            self.stopLoggingTime = stopLoggingTime
            self.timeLoggingStarted = timeLoggingStarted
            self.timeLoggingStopped = timeLoggingStopped
        }

        private enum CodingKeys: String, CodingKey {
            case isLogging = "IsLogging"
            case latestCloudWatchLogsDeliveryError = "LatestCloudWatchLogsDeliveryError"
            case latestCloudWatchLogsDeliveryTime = "LatestCloudWatchLogsDeliveryTime"
            case latestDeliveryAttemptSucceeded = "LatestDeliveryAttemptSucceeded"
            case latestDeliveryAttemptTime = "LatestDeliveryAttemptTime"
            case latestDeliveryError = "LatestDeliveryError"
            case latestDeliveryTime = "LatestDeliveryTime"
            case latestDigestDeliveryError = "LatestDigestDeliveryError"
            case latestDigestDeliveryTime = "LatestDigestDeliveryTime"
            case latestNotificationAttemptSucceeded = "LatestNotificationAttemptSucceeded"
            case latestNotificationAttemptTime = "LatestNotificationAttemptTime"
            case latestNotificationError = "LatestNotificationError"
            case latestNotificationTime = "LatestNotificationTime"
            case startLoggingTime = "StartLoggingTime"
            case stopLoggingTime = "StopLoggingTime"
            case timeLoggingStarted = "TimeLoggingStarted"
            case timeLoggingStopped = "TimeLoggingStopped"
        }
    }

    public struct ImportFailureListItem: AWSDecodableShape {
        ///  Provides the reason the import failed.
        public let errorMessage: String?
        ///  The type of import error.
        public let errorType: String?
        ///  When the import was last updated.
        public let lastUpdatedTime: Date?
        ///  The location of the failure in the S3 bucket.
        public let location: String?
        ///  The status of the import.
        public let status: ImportFailureStatus?

        @inlinable
        public init(errorMessage: String? = nil, errorType: String? = nil, lastUpdatedTime: Date? = nil, location: String? = nil, status: ImportFailureStatus? = nil) {
            self.errorMessage = errorMessage
            self.errorType = errorType
            self.lastUpdatedTime = lastUpdatedTime
            self.location = location
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case errorMessage = "ErrorMessage"
            case errorType = "ErrorType"
            case lastUpdatedTime = "LastUpdatedTime"
            case location = "Location"
            case status = "Status"
        }
    }

    public struct ImportSource: AWSEncodableShape & AWSDecodableShape {
        ///  The source S3 bucket.
        public let s3: S3ImportSource

        @inlinable
        public init(s3: S3ImportSource) {
            self.s3 = s3
        }

        private enum CodingKeys: String, CodingKey {
            case s3 = "S3"
        }
    }

    public struct ImportStatistics: AWSDecodableShape {
        ///  The number of trail events imported into the event data store.
        public let eventsCompleted: Int64?
        ///  The number of failed entries.
        public let failedEntries: Int64?
        /// The number of log files that completed import.
        public let filesCompleted: Int64?
        ///  The number of S3 prefixes that completed import.
        public let prefixesCompleted: Int64?
        ///  The number of S3 prefixes found for the import.
        public let prefixesFound: Int64?

        @inlinable
        public init(eventsCompleted: Int64? = nil, failedEntries: Int64? = nil, filesCompleted: Int64? = nil, prefixesCompleted: Int64? = nil, prefixesFound: Int64? = nil) {
            self.eventsCompleted = eventsCompleted
            self.failedEntries = failedEntries
            self.filesCompleted = filesCompleted
            self.prefixesCompleted = prefixesCompleted
            self.prefixesFound = prefixesFound
        }

        private enum CodingKeys: String, CodingKey {
            case eventsCompleted = "EventsCompleted"
            case failedEntries = "FailedEntries"
            case filesCompleted = "FilesCompleted"
            case prefixesCompleted = "PrefixesCompleted"
            case prefixesFound = "PrefixesFound"
        }
    }

    public struct ImportsListItem: AWSDecodableShape {
        ///  The timestamp of the import's creation.
        public let createdTimestamp: Date?
        ///  The ARN of the destination event data store.
        public let destinations: [String]?
        ///  The ID of the import.
        public let importId: String?
        ///  The status of the import.
        public let importStatus: ImportStatus?
        ///  The timestamp of the import's last update.
        public let updatedTimestamp: Date?

        @inlinable
        public init(createdTimestamp: Date? = nil, destinations: [String]? = nil, importId: String? = nil, importStatus: ImportStatus? = nil, updatedTimestamp: Date? = nil) {
            self.createdTimestamp = createdTimestamp
            self.destinations = destinations
            self.importId = importId
            self.importStatus = importStatus
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case destinations = "Destinations"
            case importId = "ImportId"
            case importStatus = "ImportStatus"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct IngestionStatus: AWSDecodableShape {
        /// The event ID of the most recent attempt to ingest events.
        public let latestIngestionAttemptEventID: String?
        /// The time stamp of the most recent attempt to ingest events on the channel.
        public let latestIngestionAttemptTime: Date?
        /// The error code for the most recent failure to ingest events.
        public let latestIngestionErrorCode: String?
        /// The event ID of the most recent successful ingestion of events.
        public let latestIngestionSuccessEventID: String?
        /// The time stamp of the most recent successful ingestion of events for the channel.
        public let latestIngestionSuccessTime: Date?

        @inlinable
        public init(latestIngestionAttemptEventID: String? = nil, latestIngestionAttemptTime: Date? = nil, latestIngestionErrorCode: String? = nil, latestIngestionSuccessEventID: String? = nil, latestIngestionSuccessTime: Date? = nil) {
            self.latestIngestionAttemptEventID = latestIngestionAttemptEventID
            self.latestIngestionAttemptTime = latestIngestionAttemptTime
            self.latestIngestionErrorCode = latestIngestionErrorCode
            self.latestIngestionSuccessEventID = latestIngestionSuccessEventID
            self.latestIngestionSuccessTime = latestIngestionSuccessTime
        }

        private enum CodingKeys: String, CodingKey {
            case latestIngestionAttemptEventID = "LatestIngestionAttemptEventID"
            case latestIngestionAttemptTime = "LatestIngestionAttemptTime"
            case latestIngestionErrorCode = "LatestIngestionErrorCode"
            case latestIngestionSuccessEventID = "LatestIngestionSuccessEventID"
            case latestIngestionSuccessTime = "LatestIngestionSuccessTime"
        }
    }

    public struct InsightSelector: AWSEncodableShape & AWSDecodableShape {
        /// The type of Insights events to log on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types. The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.
        public let insightType: InsightType?

        @inlinable
        public init(insightType: InsightType? = nil) {
            self.insightType = insightType
        }

        private enum CodingKeys: String, CodingKey {
            case insightType = "InsightType"
        }
    }

    public struct ListChannelsRequest: AWSEncodableShape {
        ///  The maximum number of CloudTrail channels to display on a single page.
        public let maxResults: Int?
        /// The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?

        @inlinable
        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListChannelsResponse: AWSDecodableShape {
        ///  The list of channels in the account.
        public let channels: [Channel]?
        /// The token to use to get the next page of results after a previous API call.
        public let nextToken: String?

        @inlinable
        public init(channels: [Channel]? = nil, nextToken: String? = nil) {
            self.channels = channels
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case channels = "Channels"
            case nextToken = "NextToken"
        }
    }

    public struct ListDashboardsRequest: AWSEncodableShape {
        ///  The maximum number of dashboards to display on a single page.
        public let maxResults: Int?
        /// Specify a name prefix to filter on.
        public let namePrefix: String?
        ///  A token you can use to get the next page of dashboard results.
        public let nextToken: String?
        /// Specify a dashboard type to filter on: CUSTOM or MANAGED.
        public let type: DashboardType?

        @inlinable
        public init(maxResults: Int? = nil, namePrefix: String? = nil, nextToken: String? = nil, type: DashboardType? = nil) {
            self.maxResults = maxResults
            self.namePrefix = namePrefix
            self.nextToken = nextToken
            self.type = type
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.namePrefix, name: "namePrefix", parent: name, max: 128)
            try self.validate(self.namePrefix, name: "namePrefix", parent: name, min: 3)
            try self.validate(self.namePrefix, name: "namePrefix", parent: name, pattern: "^[a-zA-Z0-9_\\-]+$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case namePrefix = "NamePrefix"
            case nextToken = "NextToken"
            case type = "Type"
        }
    }

    public struct ListDashboardsResponse: AWSDecodableShape {
        ///  Contains information about dashboards in the account, in the current Region that match the applied filters.
        public let dashboards: [DashboardDetail]?
        ///  A token you can use to get the next page of dashboard results.
        public let nextToken: String?

        @inlinable
        public init(dashboards: [DashboardDetail]? = nil, nextToken: String? = nil) {
            self.dashboards = dashboards
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case dashboards = "Dashboards"
            case nextToken = "NextToken"
        }
    }

    public struct ListEventDataStoresRequest: AWSEncodableShape {
        /// The maximum number of event data stores to display on a single page.
        public let maxResults: Int?
        /// A token you can use to get the next page of event data store results.
        public let nextToken: String?

        @inlinable
        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListEventDataStoresResponse: AWSDecodableShape {
        /// Contains information about event data stores in the account, in the current Region.
        public let eventDataStores: [EventDataStore]?
        /// A token you can use to get the next page of results.
        public let nextToken: String?

        @inlinable
        public init(eventDataStores: [EventDataStore]? = nil, nextToken: String? = nil) {
            self.eventDataStores = eventDataStores
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStores = "EventDataStores"
            case nextToken = "NextToken"
        }
    }

    public struct ListImportFailuresRequest: AWSEncodableShape {
        ///  The ID of the import.
        public let importId: String
        ///  The maximum number of failures to display on a single page.
        public let maxResults: Int?
        ///  A token you can use to get the next page of import failures.
        public let nextToken: String?

        @inlinable
        public init(importId: String, maxResults: Int? = nil, nextToken: String? = nil) {
            self.importId = importId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.importId, name: "importId", parent: name, max: 36)
            try self.validate(self.importId, name: "importId", parent: name, min: 36)
            try self.validate(self.importId, name: "importId", parent: name, pattern: "^[a-f0-9\\-]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case importId = "ImportId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListImportFailuresResponse: AWSDecodableShape {
        ///  Contains information about the import failures.
        public let failures: [ImportFailureListItem]?
        ///  A token you can use to get the next page of results.
        public let nextToken: String?

        @inlinable
        public init(failures: [ImportFailureListItem]? = nil, nextToken: String? = nil) {
            self.failures = failures
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case failures = "Failures"
            case nextToken = "NextToken"
        }
    }

    public struct ListImportsRequest: AWSEncodableShape {
        ///  The ARN of the destination event data store.
        public let destination: String?
        ///  The status of the import.
        public let importStatus: ImportStatus?
        ///  The maximum number of imports to display on a single page.
        public let maxResults: Int?
        ///  A token you can use to get the next page of import results.
        public let nextToken: String?

        @inlinable
        public init(destination: String? = nil, importStatus: ImportStatus? = nil, maxResults: Int? = nil, nextToken: String? = nil) {
            self.destination = destination
            self.importStatus = importStatus
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.destination, name: "destination", parent: name, max: 256)
            try self.validate(self.destination, name: "destination", parent: name, min: 3)
            try self.validate(self.destination, name: "destination", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case destination = "Destination"
            case importStatus = "ImportStatus"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListImportsResponse: AWSDecodableShape {
        ///  The list of returned imports.
        public let imports: [ImportsListItem]?
        ///  A token you can use to get the next page of import results.
        public let nextToken: String?

        @inlinable
        public init(imports: [ImportsListItem]? = nil, nextToken: String? = nil) {
            self.imports = imports
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case imports = "Imports"
            case nextToken = "NextToken"
        }
    }

    public struct ListInsightsMetricDataRequest: AWSEncodableShape {
        /// Type of data points to return. Valid values are NonZeroData and  FillWithZeros. The default is NonZeroData.
        public let dataType: InsightsMetricDataType?
        /// Specifies, in UTC, the end time for time-series data. The value specified is exclusive;  results include data points up to the specified time stamp. The default is the time of request.
        public let endTime: Date?
        /// Conditionally required if the InsightType parameter is set to ApiErrorRateInsight. If returning metrics for the ApiErrorRateInsight Insights type, this is the error to retrieve data for. For example, AccessDenied.
        public let errorCode: String?
        /// The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.
        public let eventName: String
        /// The Amazon Web Services service to which the request was made, such as iam.amazonaws.com or s3.amazonaws.com.
        public let eventSource: String
        /// The type of CloudTrail Insights event, which is either ApiCallRateInsight or ApiErrorRateInsight.  The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.  The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes.
        public let insightType: InsightType
        /// The maximum number of data points to return. Valid values are integers from 1 to 21600.  The default value is 21600.
        public let maxResults: Int?
        /// Returned if all datapoints can't be returned in a single call. For example, due to reaching MaxResults. Add this parameter to the request to continue retrieving results starting from the last evaluated point.
        public let nextToken: String?
        /// Granularity of data to retrieve, in seconds. Valid values are 60, 300, and 3600.  If you specify any other value, you will get an error. The default is 3600 seconds.
        public let period: Int?
        /// Specifies, in UTC, the start time for time-series data. The value specified is inclusive; results include data points with the specified time stamp. The default is 90 days before the time of request.
        public let startTime: Date?

        @inlinable
        public init(dataType: InsightsMetricDataType? = nil, endTime: Date? = nil, errorCode: String? = nil, eventName: String, eventSource: String, insightType: InsightType, maxResults: Int? = nil, nextToken: String? = nil, period: Int? = nil, startTime: Date? = nil) {
            self.dataType = dataType
            self.endTime = endTime
            self.errorCode = errorCode
            self.eventName = eventName
            self.eventSource = eventSource
            self.insightType = insightType
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.period = period
            self.startTime = startTime
        }

        public func validate(name: String) throws {
            try self.validate(self.errorCode, name: "errorCode", parent: name, max: 128)
            try self.validate(self.errorCode, name: "errorCode", parent: name, pattern: "^[\\w\\d\\s_.,\\-:\\[\\]]+$")
            try self.validate(self.eventName, name: "eventName", parent: name, max: 128)
            try self.validate(self.eventName, name: "eventName", parent: name, pattern: "^[A-Za-z0-9_]+$")
            try self.validate(self.eventSource, name: "eventSource", parent: name, max: 256)
            try self.validate(self.eventSource, name: "eventSource", parent: name, pattern: "^[a-z0-9_-]+\\.amazonaws\\.com$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 21600)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 5000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.period, name: "period", parent: name, max: 3600)
            try self.validate(self.period, name: "period", parent: name, min: 60)
        }

        private enum CodingKeys: String, CodingKey {
            case dataType = "DataType"
            case endTime = "EndTime"
            case errorCode = "ErrorCode"
            case eventName = "EventName"
            case eventSource = "EventSource"
            case insightType = "InsightType"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case period = "Period"
            case startTime = "StartTime"
        }
    }

    public struct ListInsightsMetricDataResponse: AWSDecodableShape {
        /// Only returned if InsightType parameter was set to ApiErrorRateInsight. If returning metrics for the ApiErrorRateInsight Insights type, this is the error to retrieve data for. For example, AccessDenied.
        public let errorCode: String?
        /// The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.
        public let eventName: String?
        /// The Amazon Web Services service to which the request was made, such as iam.amazonaws.com or s3.amazonaws.com.
        public let eventSource: String?
        /// The type of CloudTrail Insights event, which is either ApiCallRateInsight or ApiErrorRateInsight.  The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.  The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes.
        public let insightType: InsightType?
        /// Only returned if the full results could not be returned in a single query. You can set the NextToken parameter  in the next request to this value to continue retrieval.
        public let nextToken: String?
        /// List of timestamps at intervals corresponding to the specified time period.
        public let timestamps: [Date]?
        /// List of values representing the API call rate or error rate at each timestamp. The number of values is equal to the number of timestamps.
        public let values: [Double]?

        @inlinable
        public init(errorCode: String? = nil, eventName: String? = nil, eventSource: String? = nil, insightType: InsightType? = nil, nextToken: String? = nil, timestamps: [Date]? = nil, values: [Double]? = nil) {
            self.errorCode = errorCode
            self.eventName = eventName
            self.eventSource = eventSource
            self.insightType = insightType
            self.nextToken = nextToken
            self.timestamps = timestamps
            self.values = values
        }

        private enum CodingKeys: String, CodingKey {
            case errorCode = "ErrorCode"
            case eventName = "EventName"
            case eventSource = "EventSource"
            case insightType = "InsightType"
            case nextToken = "NextToken"
            case timestamps = "Timestamps"
            case values = "Values"
        }
    }

    public struct ListPublicKeysRequest: AWSEncodableShape {
        /// Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.
        public let endTime: Date?
        /// Reserved for future use.
        public let nextToken: String?
        /// Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.
        public let startTime: Date?

        @inlinable
        public init(endTime: Date? = nil, nextToken: String? = nil, startTime: Date? = nil) {
            self.endTime = endTime
            self.nextToken = nextToken
            self.startTime = startTime
        }

        private enum CodingKeys: String, CodingKey {
            case endTime = "EndTime"
            case nextToken = "NextToken"
            case startTime = "StartTime"
        }
    }

    public struct ListPublicKeysResponse: AWSDecodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// Contains an array of PublicKey objects.  The returned public keys may have validity time ranges that overlap.
        public let publicKeyList: [PublicKey]?

        @inlinable
        public init(nextToken: String? = nil, publicKeyList: [PublicKey]? = nil) {
            self.nextToken = nextToken
            self.publicKeyList = publicKeyList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case publicKeyList = "PublicKeyList"
        }
    }

    public struct ListQueriesRequest: AWSEncodableShape {
        /// Use with StartTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.
        public let endTime: Date?
        /// The ARN (or the ID suffix of the ARN) of an event data store on which queries were run.
        public let eventDataStore: String
        /// The maximum number of queries to show on a page.
        public let maxResults: Int?
        /// A token you can use to get the next page of results.
        public let nextToken: String?
        /// The status of queries that you want to return in results. Valid values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.
        public let queryStatus: QueryStatus?
        /// Use with EndTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.
        public let startTime: Date?

        @inlinable
        public init(endTime: Date? = nil, eventDataStore: String, maxResults: Int? = nil, nextToken: String? = nil, queryStatus: QueryStatus? = nil, startTime: Date? = nil) {
            self.endTime = endTime
            self.eventDataStore = eventDataStore
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.queryStatus = queryStatus
            self.startTime = startTime
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case endTime = "EndTime"
            case eventDataStore = "EventDataStore"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case queryStatus = "QueryStatus"
            case startTime = "StartTime"
        }
    }

    public struct ListQueriesResponse: AWSDecodableShape {
        /// A token you can use to get the next page of results.
        public let nextToken: String?
        /// Lists matching query results, and shows query ID, status, and creation time of each query.
        public let queries: [Query]?

        @inlinable
        public init(nextToken: String? = nil, queries: [Query]? = nil) {
            self.nextToken = nextToken
            self.queries = queries
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case queries = "Queries"
        }
    }

    public struct ListTagsRequest: AWSEncodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// Specifies a list of trail, event data store, dashboard, or channel ARNs whose tags will be listed. The list has a limit of 20 ARNs. Example trail ARN format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceIdList: [String]

        @inlinable
        public init(nextToken: String? = nil, resourceIdList: [String]) {
            self.nextToken = nextToken
            self.resourceIdList = resourceIdList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case resourceIdList = "ResourceIdList"
        }
    }

    public struct ListTagsResponse: AWSDecodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// A list of resource tags.
        public let resourceTagList: [ResourceTag]?

        @inlinable
        public init(nextToken: String? = nil, resourceTagList: [ResourceTag]? = nil) {
            self.nextToken = nextToken
            self.resourceTagList = resourceTagList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case resourceTagList = "ResourceTagList"
        }
    }

    public struct ListTrailsRequest: AWSEncodableShape {
        /// The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?

        @inlinable
        public init(nextToken: String? = nil) {
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
        }
    }

    public struct ListTrailsResponse: AWSDecodableShape {
        /// The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?
        /// Returns the name, ARN, and home Region of trails in the current account.
        public let trails: [TrailInfo]?

        @inlinable
        public init(nextToken: String? = nil, trails: [TrailInfo]? = nil) {
            self.nextToken = nextToken
            self.trails = trails
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case trails = "Trails"
        }
    }

    public struct LookupAttribute: AWSEncodableShape {
        /// Specifies an attribute on which to filter the events returned.
        public let attributeKey: LookupAttributeKey
        /// Specifies a value for the specified AttributeKey. The maximum length for the AttributeValue is 2000 characters. The following characters ('_', ' ', ',', '\\n') count as two characters towards the 2000 character limit.
        public let attributeValue: String

        @inlinable
        public init(attributeKey: LookupAttributeKey, attributeValue: String) {
            self.attributeKey = attributeKey
            self.attributeValue = attributeValue
        }

        public func validate(name: String) throws {
            try self.validate(self.attributeValue, name: "attributeValue", parent: name, max: 2000)
            try self.validate(self.attributeValue, name: "attributeValue", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case attributeKey = "AttributeKey"
            case attributeValue = "AttributeValue"
        }
    }

    public struct LookupEventsRequest: AWSEncodableShape {
        /// Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned.
        public let endTime: Date?
        /// Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify insight as the value of EventCategory, no Insights events are returned.
        public let eventCategory: EventCategory?
        /// Contains a list of lookup attributes. Currently the list can contain only one item.
        public let lookupAttributes: [LookupAttribute]?
        /// The number of events to return. Possible values are 1 through 50. The default is 50.
        public let maxResults: Int?
        /// The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?
        /// Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned.
        public let startTime: Date?

        @inlinable
        public init(endTime: Date? = nil, eventCategory: EventCategory? = nil, lookupAttributes: [LookupAttribute]? = nil, maxResults: Int? = nil, nextToken: String? = nil, startTime: Date? = nil) {
            self.endTime = endTime
            self.eventCategory = eventCategory
            self.lookupAttributes = lookupAttributes
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.startTime = startTime
        }

        public func validate(name: String) throws {
            try self.lookupAttributes?.forEach {
                try $0.validate(name: "\(name).lookupAttributes[]")
            }
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 50)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case endTime = "EndTime"
            case eventCategory = "EventCategory"
            case lookupAttributes = "LookupAttributes"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case startTime = "StartTime"
        }
    }

    public struct LookupEventsResponse: AWSDecodableShape {
        /// A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.
        public let events: [Event]?
        /// The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?

        @inlinable
        public init(events: [Event]? = nil, nextToken: String? = nil) {
            self.events = events
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case events = "Events"
            case nextToken = "NextToken"
        }
    }

    public struct PartitionKey: AWSDecodableShape {
        /// The name of the partition key.
        public let name: String
        /// The data type of the partition key. For example, bigint or string.
        public let type: String

        @inlinable
        public init(name: String, type: String) {
            self.name = name
            self.type = type
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
            case type = "Type"
        }
    }

    public struct PublicKey: AWSDecodableShape {
        /// The fingerprint of the public key.
        public let fingerprint: String?
        /// The ending time of validity of the public key.
        public let validityEndTime: Date?
        /// The starting time of validity of the public key.
        public let validityStartTime: Date?
        /// The DER encoded public key value in PKCS#1 format.
        public let value: AWSBase64Data?

        @inlinable
        public init(fingerprint: String? = nil, validityEndTime: Date? = nil, validityStartTime: Date? = nil, value: AWSBase64Data? = nil) {
            self.fingerprint = fingerprint
            self.validityEndTime = validityEndTime
            self.validityStartTime = validityStartTime
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case fingerprint = "Fingerprint"
            case validityEndTime = "ValidityEndTime"
            case validityStartTime = "ValidityStartTime"
            case value = "Value"
        }
    }

    public struct PutEventConfigurationRequest: AWSEncodableShape {
        /// A list of context key selectors that will be included to provide enriched event data.
        public let contextKeySelectors: [ContextKeySelector]
        /// The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which you want to update event configuration settings.
        public let eventDataStore: String?
        /// The maximum allowed size for events to be stored in the specified event data store. If you are using context key selectors, MaxEventSize must be set to Large.
        public let maxEventSize: MaxEventSize

        @inlinable
        public init(contextKeySelectors: [ContextKeySelector], eventDataStore: String? = nil, maxEventSize: MaxEventSize) {
            self.contextKeySelectors = contextKeySelectors
            self.eventDataStore = eventDataStore
            self.maxEventSize = maxEventSize
        }

        public func validate(name: String) throws {
            try self.contextKeySelectors.forEach {
                try $0.validate(name: "\(name).contextKeySelectors[]")
            }
            try self.validate(self.contextKeySelectors, name: "contextKeySelectors", parent: name, max: 2)
        }

        private enum CodingKeys: String, CodingKey {
            case contextKeySelectors = "ContextKeySelectors"
            case eventDataStore = "EventDataStore"
            case maxEventSize = "MaxEventSize"
        }
    }

    public struct PutEventConfigurationResponse: AWSDecodableShape {
        /// The list of context key selectors that are configured for the event data store.
        public let contextKeySelectors: [ContextKeySelector]?
        /// The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which the event configuration settings were updated.
        public let eventDataStoreArn: String?
        /// The maximum allowed size for events stored in the specified event data store.
        public let maxEventSize: MaxEventSize?

        @inlinable
        public init(contextKeySelectors: [ContextKeySelector]? = nil, eventDataStoreArn: String? = nil, maxEventSize: MaxEventSize? = nil) {
            self.contextKeySelectors = contextKeySelectors
            self.eventDataStoreArn = eventDataStoreArn
            self.maxEventSize = maxEventSize
        }

        private enum CodingKeys: String, CodingKey {
            case contextKeySelectors = "ContextKeySelectors"
            case eventDataStoreArn = "EventDataStoreArn"
            case maxEventSize = "MaxEventSize"
        }
    }

    public struct PutEventSelectorsRequest: AWSEncodableShape {
        ///  Specifies the settings for advanced event selectors. You can use advanced event selectors to  log management events, data events for all resource types, and network activity events. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors, but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events and  Logging network activity events in the CloudTrail User Guide.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types:    AWS::DynamoDB::Table     AWS::Lambda::Function     AWS::S3::Object    You can't use event selectors to log network activity events. You can configure up to five event selectors for a trail. You can use either EventSelectors or AdvancedEventSelectors in a PutEventSelectors request, but not both. If you apply EventSelectors to a trail, any existing AdvancedEventSelectors are overwritten.
        public let eventSelectors: [EventSelector]?
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the following format.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailName: String

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailName: String) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailName = trailName
        }

        public func validate(name: String) throws {
            try self.advancedEventSelectors?.forEach {
                try $0.validate(name: "\(name).advancedEventSelectors[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailName = "TrailName"
        }
    }

    public struct PutEventSelectorsResponse: AWSDecodableShape {
        /// Specifies the advanced event selectors configured for your trail.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// Specifies the event selectors configured for your trail.
        public let eventSelectors: [EventSelector]?
        /// Specifies the ARN of the trail that was updated with event selectors. The following is the format of a trail ARN.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailARN: String? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct PutInsightSelectorsRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the  EventDataStore and InsightsDestination parameters. You cannot use this parameter with the TrailName parameter.
        public let eventDataStore: String?
        ///  The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the  EventDataStore and InsightsDestination parameters.  You cannot use this parameter with the TrailName parameter.
        public let insightsDestination: String?
        /// A JSON string that contains the Insights types you want to log on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types. The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.
        public let insightSelectors: [InsightSelector]
        /// The name of the CloudTrail trail for which you want to change or add Insights selectors. You cannot use this parameter with the EventDataStore and InsightsDestination parameters.
        public let trailName: String?

        @inlinable
        public init(eventDataStore: String? = nil, insightsDestination: String? = nil, insightSelectors: [InsightSelector], trailName: String? = nil) {
            self.eventDataStore = eventDataStore
            self.insightsDestination = insightsDestination
            self.insightSelectors = insightSelectors
            self.trailName = trailName
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.insightsDestination, name: "insightsDestination", parent: name, max: 256)
            try self.validate(self.insightsDestination, name: "insightsDestination", parent: name, min: 3)
            try self.validate(self.insightsDestination, name: "insightsDestination", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
            case insightsDestination = "InsightsDestination"
            case insightSelectors = "InsightSelectors"
            case trailName = "TrailName"
        }
    }

    public struct PutInsightSelectorsResponse: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the source event data store for which you want to change or add Insights selectors.
        public let eventDataStoreArn: String?
        ///  The ARN of the destination event data store that logs Insights events.
        public let insightsDestination: String?
        /// A JSON string that contains the Insights event types that you want to log on a trail or event data store. The valid Insights types are ApiErrorRateInsight and ApiCallRateInsight.
        public let insightSelectors: [InsightSelector]?
        /// The Amazon Resource Name (ARN) of a trail for which you want to change or add Insights selectors.
        public let trailARN: String?

        @inlinable
        public init(eventDataStoreArn: String? = nil, insightsDestination: String? = nil, insightSelectors: [InsightSelector]? = nil, trailARN: String? = nil) {
            self.eventDataStoreArn = eventDataStoreArn
            self.insightsDestination = insightsDestination
            self.insightSelectors = insightSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreArn = "EventDataStoreArn"
            case insightsDestination = "InsightsDestination"
            case insightSelectors = "InsightSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct PutResourcePolicyRequest: AWSEncodableShape {
        ///  The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy. Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceArn: String
        ///  A JSON-formatted string for an Amazon Web Services resource-based policy.  For example resource-based policies, see  CloudTrail resource-based policy examples  in the CloudTrail User Guide.
        public let resourcePolicy: String

        @inlinable
        public init(resourceArn: String, resourcePolicy: String) {
            self.resourceArn = resourceArn
            self.resourcePolicy = resourcePolicy
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 256)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 3)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.resourcePolicy, name: "resourcePolicy", parent: name, max: 8192)
            try self.validate(self.resourcePolicy, name: "resourcePolicy", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn = "ResourceArn"
            case resourcePolicy = "ResourcePolicy"
        }
    }

    public struct PutResourcePolicyResponse: AWSDecodableShape {
        ///  The default resource-based policy that is automatically generated for the delegated administrator of an Organizations organization.  This policy will be evaluated in tandem with any policy you submit for the resource. For more information about this policy,  see Default resource policy for delegated administrators.
        public let delegatedAdminResourcePolicy: String?
        ///  The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy.  Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceArn: String?
        ///  The JSON-formatted string of the Amazon Web Services resource-based policy attached to the CloudTrail event data store, dashboard, or channel.
        public let resourcePolicy: String?

        @inlinable
        public init(delegatedAdminResourcePolicy: String? = nil, resourceArn: String? = nil, resourcePolicy: String? = nil) {
            self.delegatedAdminResourcePolicy = delegatedAdminResourcePolicy
            self.resourceArn = resourceArn
            self.resourcePolicy = resourcePolicy
        }

        private enum CodingKeys: String, CodingKey {
            case delegatedAdminResourcePolicy = "DelegatedAdminResourcePolicy"
            case resourceArn = "ResourceArn"
            case resourcePolicy = "ResourcePolicy"
        }
    }

    public struct Query: AWSDecodableShape {
        /// The creation time of a query.
        public let creationTime: Date?
        /// The ID of a query.
        public let queryId: String?
        /// The status of the query. This can be QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.
        public let queryStatus: QueryStatus?

        @inlinable
        public init(creationTime: Date? = nil, queryId: String? = nil, queryStatus: QueryStatus? = nil) {
            self.creationTime = creationTime
            self.queryId = queryId
            self.queryStatus = queryStatus
        }

        private enum CodingKeys: String, CodingKey {
            case creationTime = "CreationTime"
            case queryId = "QueryId"
            case queryStatus = "QueryStatus"
        }
    }

    public struct QueryStatistics: AWSDecodableShape {
        /// The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running.
        public let bytesScanned: Int64?
        /// The number of results returned.
        public let resultsCount: Int?
        /// The total number of results returned by a query.
        public let totalResultsCount: Int?

        @inlinable
        public init(bytesScanned: Int64? = nil, resultsCount: Int? = nil, totalResultsCount: Int? = nil) {
            self.bytesScanned = bytesScanned
            self.resultsCount = resultsCount
            self.totalResultsCount = totalResultsCount
        }

        private enum CodingKeys: String, CodingKey {
            case bytesScanned = "BytesScanned"
            case resultsCount = "ResultsCount"
            case totalResultsCount = "TotalResultsCount"
        }
    }

    public struct QueryStatisticsForDescribeQuery: AWSDecodableShape {
        /// The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running.
        public let bytesScanned: Int64?
        /// The creation time of the query.
        public let creationTime: Date?
        /// The number of events that matched a query.
        public let eventsMatched: Int64?
        /// The number of events that the query scanned in the event data store.
        public let eventsScanned: Int64?
        /// The query's run time, in milliseconds.
        public let executionTimeInMillis: Int?

        @inlinable
        public init(bytesScanned: Int64? = nil, creationTime: Date? = nil, eventsMatched: Int64? = nil, eventsScanned: Int64? = nil, executionTimeInMillis: Int? = nil) {
            self.bytesScanned = bytesScanned
            self.creationTime = creationTime
            self.eventsMatched = eventsMatched
            self.eventsScanned = eventsScanned
            self.executionTimeInMillis = executionTimeInMillis
        }

        private enum CodingKeys: String, CodingKey {
            case bytesScanned = "BytesScanned"
            case creationTime = "CreationTime"
            case eventsMatched = "EventsMatched"
            case eventsScanned = "EventsScanned"
            case executionTimeInMillis = "ExecutionTimeInMillis"
        }
    }

    public struct RefreshSchedule: AWSEncodableShape & AWSDecodableShape {
        /// The frequency at which you want the dashboard refreshed.
        public let frequency: RefreshScheduleFrequency?
        /// Specifies whether the refresh schedule is enabled. Set the value to ENABLED to enable the refresh schedule, or to DISABLED to turn off the refresh schedule.
        public let status: RefreshScheduleStatus?
        ///  The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00.
        public let timeOfDay: String?

        @inlinable
        public init(frequency: RefreshScheduleFrequency? = nil, status: RefreshScheduleStatus? = nil, timeOfDay: String? = nil) {
            self.frequency = frequency
            self.status = status
            self.timeOfDay = timeOfDay
        }

        public func validate(name: String) throws {
            try self.validate(self.timeOfDay, name: "timeOfDay", parent: name, pattern: "^[0-9]{2}:[0-9]{2}$")
        }

        private enum CodingKeys: String, CodingKey {
            case frequency = "Frequency"
            case status = "Status"
            case timeOfDay = "TimeOfDay"
        }
    }

    public struct RefreshScheduleFrequency: AWSEncodableShape & AWSDecodableShape {
        ///  The unit to use for the refresh.
        ///  For custom dashboards, the unit can be HOURS or DAYS. For the Highlights dashboard, the Unit must be HOURS.
        public let unit: RefreshScheduleFrequencyUnit?
        /// The value for the refresh schedule.
        ///   For custom dashboards, the following values are valid when the unit is HOURS: 1, 6, 12, 24  For custom dashboards, the only valid value when the unit is DAYS is 1. For the Highlights dashboard, the Value must be 6.
        public let value: Int?

        @inlinable
        public init(unit: RefreshScheduleFrequencyUnit? = nil, value: Int? = nil) {
            self.unit = unit
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case unit = "Unit"
            case value = "Value"
        }
    }

    public struct RegisterOrganizationDelegatedAdminRequest: AWSEncodableShape {
        /// An organization member account ID that you want to designate as a delegated administrator.
        public let memberAccountId: String

        @inlinable
        public init(memberAccountId: String) {
            self.memberAccountId = memberAccountId
        }

        public func validate(name: String) throws {
            try self.validate(self.memberAccountId, name: "memberAccountId", parent: name, max: 16)
            try self.validate(self.memberAccountId, name: "memberAccountId", parent: name, min: 12)
            try self.validate(self.memberAccountId, name: "memberAccountId", parent: name, pattern: "^\\d+$")
        }

        private enum CodingKeys: String, CodingKey {
            case memberAccountId = "MemberAccountId"
        }
    }

    public struct RegisterOrganizationDelegatedAdminResponse: AWSDecodableShape {
        public init() {}
    }

    public struct RemoveTagsRequest: AWSEncodableShape {
        /// Specifies the ARN of the trail, event data store, dashboard, or channel from which tags should be removed. Example trail ARN format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
        public let resourceId: String
        /// Specifies a list of tags to be removed.
        public let tagsList: [Tag]

        @inlinable
        public init(resourceId: String, tagsList: [Tag]) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        public func validate(name: String) throws {
            try self.tagsList.forEach {
                try $0.validate(name: "\(name).tagsList[]")
            }
            try self.validate(self.tagsList, name: "tagsList", parent: name, max: 200)
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct RemoveTagsResponse: AWSDecodableShape {
        public init() {}
    }

    public struct RequestWidget: AWSEncodableShape {
        ///  The optional query parameters. The following query parameters are valid: $StartTime$, $EndTime$, and $Period$.
        public let queryParameters: [String]?
        /// The query statement for the widget. For custom dashboard widgets, you can query across multiple event data stores as long as all event data stores exist in your account.
        ///   When a query uses ? with eventTime, ? must be surrounded by single quotes as follows: '?'.
        public let queryStatement: String
        ///  The view properties for the widget. For more information about view properties, see  View properties for widgets in the CloudTrail User Guide.
        public let viewProperties: [String: String]

        @inlinable
        public init(queryParameters: [String]? = nil, queryStatement: String, viewProperties: [String: String]) {
            self.queryParameters = queryParameters
            self.queryStatement = queryStatement
            self.viewProperties = viewProperties
        }

        public func validate(name: String) throws {
            try self.queryParameters?.forEach {
                try validate($0, name: "queryParameters[]", parent: name, max: 1024)
                try validate($0, name: "queryParameters[]", parent: name, min: 1)
                try validate($0, name: "queryParameters[]", parent: name, pattern: ".*")
            }
            try self.validate(self.queryParameters, name: "queryParameters", parent: name, max: 10)
            try self.validate(self.queryParameters, name: "queryParameters", parent: name, min: 1)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, max: 10000)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, min: 1)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, pattern: "^(?s)")
            try self.viewProperties.forEach {
                try validate($0.key, name: "viewProperties.key", parent: name, max: 128)
                try validate($0.key, name: "viewProperties.key", parent: name, min: 3)
                try validate($0.key, name: "viewProperties.key", parent: name, pattern: "^[a-zA-Z0-9._\\-]+$")
                try validate($0.value, name: "viewProperties[\"\($0.key)\"]", parent: name, max: 128)
                try validate($0.value, name: "viewProperties[\"\($0.key)\"]", parent: name, min: 1)
                try validate($0.value, name: "viewProperties[\"\($0.key)\"]", parent: name, pattern: "^[a-zA-Z0-9._\\- ]+$")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case queryParameters = "QueryParameters"
            case queryStatement = "QueryStatement"
            case viewProperties = "ViewProperties"
        }
    }

    public struct Resource: AWSDecodableShape {
        /// The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto-scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance.
        public let resourceName: String?
        /// The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: Instance for EC2, Trail for CloudTrail, DBInstance for Amazon RDS, and AccessKey for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events.
        public let resourceType: String?

        @inlinable
        public init(resourceName: String? = nil, resourceType: String? = nil) {
            self.resourceName = resourceName
            self.resourceType = resourceType
        }

        private enum CodingKeys: String, CodingKey {
            case resourceName = "ResourceName"
            case resourceType = "ResourceType"
        }
    }

    public struct ResourceTag: AWSDecodableShape {
        /// Specifies the ARN of the resource.
        public let resourceId: String?
        /// A list of tags.
        public let tagsList: [Tag]?

        @inlinable
        public init(resourceId: String? = nil, tagsList: [Tag]? = nil) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct RestoreEventDataStoreRequest: AWSEncodableShape {
        /// The ARN (or the ID suffix of the ARN) of the event data store that you want to restore.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct RestoreEventDataStoreResponse: AWSDecodableShape {
        /// The advanced event selectors that were used to select events.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The billing mode for the event data store.
        public let billingMode: BillingMode?
        /// The timestamp of an event data store's creation.
        public let createdTimestamp: Date?
        /// The event data store ARN.
        public let eventDataStoreArn: String?
        /// Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Indicates whether the event data store is collecting events from all Regions, or only from the Region in which the event data store was created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String?
        /// Indicates whether an event data store is collecting logged events for an organization in Organizations.
        public let organizationEnabled: Bool?
        /// The retention period, in days.
        public let retentionPeriod: Int?
        /// The status of the event data store.
        public let status: EventDataStoreStatus?
        /// Indicates that termination protection is enabled and the event data store cannot be automatically deleted.
        public let terminationProtectionEnabled: Bool?
        /// The timestamp that shows when an event data store was updated, if applicable. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.
        public let updatedTimestamp: Date?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, createdTimestamp: Date? = nil, eventDataStoreArn: String? = nil, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, status: EventDataStoreStatus? = nil, terminationProtectionEnabled: Bool? = nil, updatedTimestamp: Date? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.createdTimestamp = createdTimestamp
            self.eventDataStoreArn = eventDataStoreArn
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.status = status
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case createdTimestamp = "CreatedTimestamp"
            case eventDataStoreArn = "EventDataStoreArn"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case status = "Status"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct S3ImportSource: AWSEncodableShape & AWSDecodableShape {
        ///  The IAM ARN role used to access the source S3 bucket.
        public let s3BucketAccessRoleArn: String
        ///  The Region associated with the source S3 bucket.
        public let s3BucketRegion: String
        ///  The URI for the source S3 bucket.
        public let s3LocationUri: String

        @inlinable
        public init(s3BucketAccessRoleArn: String, s3BucketRegion: String, s3LocationUri: String) {
            self.s3BucketAccessRoleArn = s3BucketAccessRoleArn
            self.s3BucketRegion = s3BucketRegion
            self.s3LocationUri = s3LocationUri
        }

        private enum CodingKeys: String, CodingKey {
            case s3BucketAccessRoleArn = "S3BucketAccessRoleArn"
            case s3BucketRegion = "S3BucketRegion"
            case s3LocationUri = "S3LocationUri"
        }
    }

    public struct SearchSampleQueriesRequest: AWSEncodableShape {
        ///  The maximum number of results to return on a single page. The default value is 10.
        public let maxResults: Int?
        ///  A token you can use to get the next page of results. The length constraint is in characters, not words.
        public let nextToken: String?
        ///  The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words.
        public let searchPhrase: String

        @inlinable
        public init(maxResults: Int? = nil, nextToken: String? = nil, searchPhrase: String) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.searchPhrase = searchPhrase
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 50)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 1000)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 4)
            try self.validate(self.nextToken, name: "nextToken", parent: name, pattern: ".*")
            try self.validate(self.searchPhrase, name: "searchPhrase", parent: name, max: 1000)
            try self.validate(self.searchPhrase, name: "searchPhrase", parent: name, min: 2)
            try self.validate(self.searchPhrase, name: "searchPhrase", parent: name, pattern: "^[ -~\\n]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case searchPhrase = "SearchPhrase"
        }
    }

    public struct SearchSampleQueriesResponse: AWSDecodableShape {
        ///  A token you can use to get the next page of results.
        public let nextToken: String?
        ///  A list of objects containing the search results ordered from most relevant to least relevant.
        public let searchResults: [SearchSampleQueriesSearchResult]?

        @inlinable
        public init(nextToken: String? = nil, searchResults: [SearchSampleQueriesSearchResult]? = nil) {
            self.nextToken = nextToken
            self.searchResults = searchResults
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case searchResults = "SearchResults"
        }
    }

    public struct SearchSampleQueriesSearchResult: AWSDecodableShape {
        ///  A longer description of a sample query.
        public let description: String?
        ///  The name of a sample query.
        public let name: String?
        ///  A value between 0 and 1 indicating the similarity between the search phrase and result.
        public let relevance: Float?
        ///  The SQL code of the sample query.
        public let sql: String?

        @inlinable
        public init(description: String? = nil, name: String? = nil, relevance: Float? = nil, sql: String? = nil) {
            self.description = description
            self.name = name
            self.relevance = relevance
            self.sql = sql
        }

        private enum CodingKeys: String, CodingKey {
            case description = "Description"
            case name = "Name"
            case relevance = "Relevance"
            case sql = "SQL"
        }
    }

    public struct SourceConfig: AWSDecodableShape {
        ///  The advanced event selectors that are configured for the channel.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        ///  Specifies whether the channel applies to a single Region or to all Regions.
        public let applyToAllRegions: Bool?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, applyToAllRegions: Bool? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.applyToAllRegions = applyToAllRegions
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case applyToAllRegions = "ApplyToAllRegions"
        }
    }

    public struct StartDashboardRefreshRequest: AWSEncodableShape {
        /// The name or ARN of the dashboard.
        public let dashboardId: String
        ///  The query parameter values for the dashboard
        ///  For custom dashboards, the following query parameters are valid: $StartTime$, $EndTime$, and $Period$. For managed dashboards, the following query parameters are valid: $StartTime$, $EndTime$, $Period$, and $EventDataStoreId$. The $EventDataStoreId$ query parameter is required.
        public let queryParameterValues: [String: String]?

        @inlinable
        public init(dashboardId: String, queryParameterValues: [String: String]? = nil) {
            self.dashboardId = dashboardId
            self.queryParameterValues = queryParameterValues
        }

        public func validate(name: String) throws {
            try self.validate(self.dashboardId, name: "dashboardId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.queryParameterValues?.forEach {
                try validate($0.key, name: "queryParameterValues.key", parent: name, max: 128)
                try validate($0.key, name: "queryParameterValues.key", parent: name, min: 3)
                try validate($0.key, name: "queryParameterValues.key", parent: name, pattern: "^[a-zA-Z0-9._/\\-:$]+$")
                try validate($0.value, name: "queryParameterValues[\"\($0.key)\"]", parent: name, max: 128)
                try validate($0.value, name: "queryParameterValues[\"\($0.key)\"]", parent: name, min: 1)
                try validate($0.value, name: "queryParameterValues[\"\($0.key)\"]", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardId = "DashboardId"
            case queryParameterValues = "QueryParameterValues"
        }
    }

    public struct StartDashboardRefreshResponse: AWSDecodableShape {
        /// The refresh ID for the dashboard.
        public let refreshId: String?

        @inlinable
        public init(refreshId: String? = nil) {
            self.refreshId = refreshId
        }

        private enum CodingKeys: String, CodingKey {
            case refreshId = "RefreshId"
        }
    }

    public struct StartEventDataStoreIngestionRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the event data store for which you want to start ingestion.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct StartEventDataStoreIngestionResponse: AWSDecodableShape {
        public init() {}
    }

    public struct StartImportRequest: AWSEncodableShape {
        ///  The ARN of the destination event data store. Use this parameter for a new import.
        public let destinations: [String]?
        ///  Use with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.
        public let endEventTime: Date?
        ///  The ID of the import. Use this parameter when you are retrying an import.
        public let importId: String?
        ///  The source S3 bucket for the import. Use this parameter for a new import.
        public let importSource: ImportSource?
        ///  Use with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified StartEventTime and EndEventTime before attempting to import events.
        public let startEventTime: Date?

        @inlinable
        public init(destinations: [String]? = nil, endEventTime: Date? = nil, importId: String? = nil, importSource: ImportSource? = nil, startEventTime: Date? = nil) {
            self.destinations = destinations
            self.endEventTime = endEventTime
            self.importId = importId
            self.importSource = importSource
            self.startEventTime = startEventTime
        }

        public func validate(name: String) throws {
            try self.destinations?.forEach {
                try validate($0, name: "destinations[]", parent: name, max: 256)
                try validate($0, name: "destinations[]", parent: name, min: 3)
                try validate($0, name: "destinations[]", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            }
            try self.validate(self.destinations, name: "destinations", parent: name, max: 1)
            try self.validate(self.destinations, name: "destinations", parent: name, min: 1)
            try self.validate(self.importId, name: "importId", parent: name, max: 36)
            try self.validate(self.importId, name: "importId", parent: name, min: 36)
            try self.validate(self.importId, name: "importId", parent: name, pattern: "^[a-f0-9\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case destinations = "Destinations"
            case endEventTime = "EndEventTime"
            case importId = "ImportId"
            case importSource = "ImportSource"
            case startEventTime = "StartEventTime"
        }
    }

    public struct StartImportResponse: AWSDecodableShape {
        ///  The timestamp for the import's creation.
        public let createdTimestamp: Date?
        ///  The ARN of the destination event data store.
        public let destinations: [String]?
        ///  Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let endEventTime: Date?
        ///  The ID of the import.
        public let importId: String?
        ///  The source S3 bucket for the import.
        public let importSource: ImportSource?
        ///  Shows the status of the import after a StartImport request. An import finishes with a status of COMPLETED if there were no failures, or FAILED if there were failures.
        public let importStatus: ImportStatus?
        ///  Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let startEventTime: Date?
        ///  The timestamp of the import's last update, if applicable.
        public let updatedTimestamp: Date?

        @inlinable
        public init(createdTimestamp: Date? = nil, destinations: [String]? = nil, endEventTime: Date? = nil, importId: String? = nil, importSource: ImportSource? = nil, importStatus: ImportStatus? = nil, startEventTime: Date? = nil, updatedTimestamp: Date? = nil) {
            self.createdTimestamp = createdTimestamp
            self.destinations = destinations
            self.endEventTime = endEventTime
            self.importId = importId
            self.importSource = importSource
            self.importStatus = importStatus
            self.startEventTime = startEventTime
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case destinations = "Destinations"
            case endEventTime = "EndEventTime"
            case importId = "ImportId"
            case importSource = "ImportSource"
            case importStatus = "ImportStatus"
            case startEventTime = "StartEventTime"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct StartLoggingRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs Amazon Web Services API calls. The following is the format of a trail ARN.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct StartLoggingResponse: AWSDecodableShape {
        public init() {}
    }

    public struct StartQueryRequest: AWSEncodableShape {
        ///  The URI for the S3 bucket where CloudTrail delivers the query results.
        public let deliveryS3Uri: String?
        /// The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        ///  The alias that identifies a query template.
        public let queryAlias: String?
        ///  The query parameters for the specified QueryAlias.
        public let queryParameters: [String]?
        /// The SQL code of your query.
        public let queryStatement: String?

        @inlinable
        public init(deliveryS3Uri: String? = nil, eventDataStoreOwnerAccountId: String? = nil, queryAlias: String? = nil, queryParameters: [String]? = nil, queryStatement: String? = nil) {
            self.deliveryS3Uri = deliveryS3Uri
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryAlias = queryAlias
            self.queryParameters = queryParameters
            self.queryStatement = queryStatement
        }

        public func validate(name: String) throws {
            try self.validate(self.deliveryS3Uri, name: "deliveryS3Uri", parent: name, max: 1024)
            try self.validate(self.deliveryS3Uri, name: "deliveryS3Uri", parent: name, pattern: "^s3://[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9](/.*)?$")
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, max: 16)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, min: 12)
            try self.validate(self.eventDataStoreOwnerAccountId, name: "eventDataStoreOwnerAccountId", parent: name, pattern: "^\\d+$")
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, max: 256)
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, min: 1)
            try self.validate(self.queryAlias, name: "queryAlias", parent: name, pattern: "^[a-zA-Z][a-zA-Z0-9._\\-]*$")
            try self.queryParameters?.forEach {
                try validate($0, name: "queryParameters[]", parent: name, max: 1024)
                try validate($0, name: "queryParameters[]", parent: name, min: 1)
                try validate($0, name: "queryParameters[]", parent: name, pattern: ".*")
            }
            try self.validate(self.queryParameters, name: "queryParameters", parent: name, max: 10)
            try self.validate(self.queryParameters, name: "queryParameters", parent: name, min: 1)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, max: 10000)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, min: 1)
            try self.validate(self.queryStatement, name: "queryStatement", parent: name, pattern: "^(?s)")
        }

        private enum CodingKeys: String, CodingKey {
            case deliveryS3Uri = "DeliveryS3Uri"
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryAlias = "QueryAlias"
            case queryParameters = "QueryParameters"
            case queryStatement = "QueryStatement"
        }
    }

    public struct StartQueryResponse: AWSDecodableShape {
        ///  The account ID of the event data store owner.
        public let eventDataStoreOwnerAccountId: String?
        /// The ID of the started query.
        public let queryId: String?

        @inlinable
        public init(eventDataStoreOwnerAccountId: String? = nil, queryId: String? = nil) {
            self.eventDataStoreOwnerAccountId = eventDataStoreOwnerAccountId
            self.queryId = queryId
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStoreOwnerAccountId = "EventDataStoreOwnerAccountId"
            case queryId = "QueryId"
        }
    }

    public struct StopEventDataStoreIngestionRequest: AWSEncodableShape {
        /// The ARN (or ID suffix of the ARN) of the event data store for which you want to stop ingestion.
        public let eventDataStore: String

        @inlinable
        public init(eventDataStore: String) {
            self.eventDataStore = eventDataStore
        }

        public func validate(name: String) throws {
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case eventDataStore = "EventDataStore"
        }
    }

    public struct StopEventDataStoreIngestionResponse: AWSDecodableShape {
        public init() {}
    }

    public struct StopImportRequest: AWSEncodableShape {
        ///  The ID of the import.
        public let importId: String

        @inlinable
        public init(importId: String) {
            self.importId = importId
        }

        public func validate(name: String) throws {
            try self.validate(self.importId, name: "importId", parent: name, max: 36)
            try self.validate(self.importId, name: "importId", parent: name, min: 36)
            try self.validate(self.importId, name: "importId", parent: name, pattern: "^[a-f0-9\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case importId = "ImportId"
        }
    }

    public struct StopImportResponse: AWSDecodableShape {
        ///  The timestamp of the import's creation.
        public let createdTimestamp: Date?
        ///  The ARN of the destination event data store.
        public let destinations: [String]?
        ///  Used with StartEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let endEventTime: Date?
        ///  The ID for the import.
        public let importId: String?
        ///  The source S3 bucket for the import.
        public let importSource: ImportSource?
        ///  Returns information on the stopped import.
        public let importStatistics: ImportStatistics?
        ///  The status of the import.
        public let importStatus: ImportStatus?
        ///  Used with EndEventTime to bound a StartImport request, and limit imported trail events to only those events logged within a specified time period.
        public let startEventTime: Date?
        ///  The timestamp of the import's last update.
        public let updatedTimestamp: Date?

        @inlinable
        public init(createdTimestamp: Date? = nil, destinations: [String]? = nil, endEventTime: Date? = nil, importId: String? = nil, importSource: ImportSource? = nil, importStatistics: ImportStatistics? = nil, importStatus: ImportStatus? = nil, startEventTime: Date? = nil, updatedTimestamp: Date? = nil) {
            self.createdTimestamp = createdTimestamp
            self.destinations = destinations
            self.endEventTime = endEventTime
            self.importId = importId
            self.importSource = importSource
            self.importStatistics = importStatistics
            self.importStatus = importStatus
            self.startEventTime = startEventTime
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case destinations = "Destinations"
            case endEventTime = "EndEventTime"
            case importId = "ImportId"
            case importSource = "ImportSource"
            case importStatistics = "ImportStatistics"
            case importStatus = "ImportStatus"
            case startEventTime = "StartEventTime"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct StopLoggingRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging Amazon Web Services API calls. The following is the format of a trail ARN.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct StopLoggingResponse: AWSDecodableShape {
        public init() {}
    }

    public struct Tag: AWSEncodableShape & AWSDecodableShape {
        /// The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.
        public let key: String
        /// The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.
        public let value: String?

        @inlinable
        public init(key: String, value: String? = nil) {
            self.key = key
            self.value = value
        }

        public func validate(name: String) throws {
            try self.validate(self.key, name: "key", parent: name, max: 128)
            try self.validate(self.key, name: "key", parent: name, min: 1)
            try self.validate(self.value, name: "value", parent: name, max: 256)
            try self.validate(self.value, name: "value", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case key = "Key"
            case value = "Value"
        }
    }

    public struct Trail: AWSDecodableShape {
        /// Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies if the trail has custom event selectors.
        public let hasCustomEventSelectors: Bool?
        /// Specifies whether a trail has insight types specified in an InsightSelector list.
        public let hasInsightSelectors: Bool?
        /// The Region in which the trail was created.
        public let homeRegion: String?
        /// Set to True to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, False.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists only in one Region or exists in all Regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Name of the trail set by calling CreateTrail. The maximum length is 128 characters.
        public let name: String?
        /// Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket naming rules.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// This field is no longer in use. Use SnsTopicARN.
        public let snsTopicName: String?
        /// Specifies the ARN of the trail. The following is the format of a trail ARN.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, hasCustomEventSelectors: Bool? = nil, hasInsightSelectors: Bool? = nil, homeRegion: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.hasCustomEventSelectors = hasCustomEventSelectors
            self.hasInsightSelectors = hasInsightSelectors
            self.homeRegion = homeRegion
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = nil
            self.trailARN = trailARN
        }

        @available(*, deprecated, message: "Members snsTopicName have been deprecated")
        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, hasCustomEventSelectors: Bool? = nil, hasInsightSelectors: Bool? = nil, homeRegion: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, snsTopicName: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.hasCustomEventSelectors = hasCustomEventSelectors
            self.hasInsightSelectors = hasInsightSelectors
            self.homeRegion = homeRegion
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = snsTopicName
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case hasCustomEventSelectors = "HasCustomEventSelectors"
            case hasInsightSelectors = "HasInsightSelectors"
            case homeRegion = "HomeRegion"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case snsTopicName = "SnsTopicName"
            case trailARN = "TrailARN"
        }
    }

    public struct TrailInfo: AWSDecodableShape {
        /// The Amazon Web Services Region in which a trail was created.
        public let homeRegion: String?
        /// The name of a trail.
        public let name: String?
        /// The ARN of a trail.
        public let trailARN: String?

        @inlinable
        public init(homeRegion: String? = nil, name: String? = nil, trailARN: String? = nil) {
            self.homeRegion = homeRegion
            self.name = name
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case homeRegion = "HomeRegion"
            case name = "Name"
            case trailARN = "TrailARN"
        }
    }

    public struct UpdateChannelRequest: AWSEncodableShape {
        /// The ARN or ID (the ARN suffix) of the channel that you want to update.
        public let channel: String
        /// The ARNs of event data stores that you want to log events arriving through the channel.
        public let destinations: [Destination]?
        ///  Changes the name of the channel.
        public let name: String?

        @inlinable
        public init(channel: String, destinations: [Destination]? = nil, name: String? = nil) {
            self.channel = channel
            self.destinations = destinations
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.channel, name: "channel", parent: name, max: 256)
            try self.validate(self.channel, name: "channel", parent: name, min: 3)
            try self.validate(self.channel, name: "channel", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.destinations?.forEach {
                try $0.validate(name: "\(name).destinations[]")
            }
            try self.validate(self.destinations, name: "destinations", parent: name, max: 200)
            try self.validate(self.destinations, name: "destinations", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 128)
            try self.validate(self.name, name: "name", parent: name, min: 3)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9._\\-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case channel = "Channel"
            case destinations = "Destinations"
            case name = "Name"
        }
    }

    public struct UpdateChannelResponse: AWSDecodableShape {
        /// The ARN of the channel that was updated.
        public let channelArn: String?
        /// The event data stores that log events arriving through the channel.
        public let destinations: [Destination]?
        /// The name of the channel that was updated.
        public let name: String?
        /// The event source of the channel that was updated.
        public let source: String?

        @inlinable
        public init(channelArn: String? = nil, destinations: [Destination]? = nil, name: String? = nil, source: String? = nil) {
            self.channelArn = channelArn
            self.destinations = destinations
            self.name = name
            self.source = source
        }

        private enum CodingKeys: String, CodingKey {
            case channelArn = "ChannelArn"
            case destinations = "Destinations"
            case name = "Name"
            case source = "Source"
        }
    }

    public struct UpdateDashboardRequest: AWSEncodableShape {
        ///  The name or ARN of the dashboard.
        public let dashboardId: String
        /// The refresh schedule configuration for the dashboard.
        public let refreshSchedule: RefreshSchedule?
        ///  Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.
        public let terminationProtectionEnabled: Bool?
        /// An array of widgets for the dashboard. A custom dashboard can have a maximum of 10 widgets.
        ///  To add new widgets, pass in an array that includes the existing widgets along with any new widgets. Run the GetDashboard operation to get the list of widgets for the dashboard. To remove widgets, pass in an array that includes the existing widgets minus the widgets you want removed.
        public let widgets: [RequestWidget]?

        @inlinable
        public init(dashboardId: String, refreshSchedule: RefreshSchedule? = nil, terminationProtectionEnabled: Bool? = nil, widgets: [RequestWidget]? = nil) {
            self.dashboardId = dashboardId
            self.refreshSchedule = refreshSchedule
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.widgets = widgets
        }

        public func validate(name: String) throws {
            try self.validate(self.dashboardId, name: "dashboardId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.refreshSchedule?.validate(name: "\(name).refreshSchedule")
            try self.widgets?.forEach {
                try $0.validate(name: "\(name).widgets[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case dashboardId = "DashboardId"
            case refreshSchedule = "RefreshSchedule"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case widgets = "Widgets"
        }
    }

    public struct UpdateDashboardResponse: AWSDecodableShape {
        ///  The timestamp that shows when the dashboard was created.
        public let createdTimestamp: Date?
        /// The ARN for the dashboard.
        public let dashboardArn: String?
        /// The name for the dashboard.
        public let name: String?
        /// The refresh schedule for the dashboard, if configured.
        public let refreshSchedule: RefreshSchedule?
        ///  Indicates whether termination protection is enabled for the dashboard.
        public let terminationProtectionEnabled: Bool?
        /// The type of dashboard.
        public let type: DashboardType?
        ///  The timestamp that shows when the dashboard was updated.
        public let updatedTimestamp: Date?
        /// An array of widgets for the dashboard.
        public let widgets: [Widget]?

        @inlinable
        public init(createdTimestamp: Date? = nil, dashboardArn: String? = nil, name: String? = nil, refreshSchedule: RefreshSchedule? = nil, terminationProtectionEnabled: Bool? = nil, type: DashboardType? = nil, updatedTimestamp: Date? = nil, widgets: [Widget]? = nil) {
            self.createdTimestamp = createdTimestamp
            self.dashboardArn = dashboardArn
            self.name = name
            self.refreshSchedule = refreshSchedule
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.type = type
            self.updatedTimestamp = updatedTimestamp
            self.widgets = widgets
        }

        private enum CodingKeys: String, CodingKey {
            case createdTimestamp = "CreatedTimestamp"
            case dashboardArn = "DashboardArn"
            case name = "Name"
            case refreshSchedule = "RefreshSchedule"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case type = "Type"
            case updatedTimestamp = "UpdatedTimestamp"
            case widgets = "Widgets"
        }
    }

    public struct UpdateEventDataStoreRequest: AWSEncodableShape {
        /// The advanced event selectors used to select events for the event data store. You can configure up to five advanced event selectors for each event data store.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        ///  You can't change the billing mode from EXTENDABLE_RETENTION_PRICING to FIXED_RETENTION_PRICING. If BillingMode is set to  EXTENDABLE_RETENTION_PRICING and you want to use FIXED_RETENTION_PRICING instead, you'll need to stop ingestion on the event data store and create a new event data store that uses FIXED_RETENTION_PRICING.  The billing mode for the event data store determines the cost  for ingesting events and the default and maximum retention period for the event data store. The following are the possible values:    EXTENDABLE_RETENTION_PRICING - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is  366 days.    FIXED_RETENTION_PRICING - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years).  The default retention period for this billing mode is 2557 days.   For more information about CloudTrail pricing,  see CloudTrail Pricing and  Managing CloudTrail Lake costs.
        public let billingMode: BillingMode?
        /// The ARN (or the ID suffix of the ARN) of the event data store that you want to update.
        public let eventDataStore: String
        /// Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by alias/, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.  Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store.  CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide. Examples:    alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:alias/MyAliasName     arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012     12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether an event data store collects events from all Regions, or only from the Region in which it was created.
        public let multiRegionEnabled: Bool?
        /// The event data store name.
        public let name: String?
        /// Specifies whether an event data store collects events logged for an organization in Organizations.  Only the management account for the organization can convert an organization event data store to a non-organization event data store, or convert a non-organization event data store to  an organization event data store.
        public let organizationEnabled: Bool?
        /// The retention period of the event data store, in days. If BillingMode is set to EXTENDABLE_RETENTION_PRICING, you can set a retention period of up to 3653 days, the equivalent of 10 years. If BillingMode is set to FIXED_RETENTION_PRICING, you can set a retention period of up to 2557 days, the equivalent of seven years. CloudTrail  Lake determines whether to retain an event by checking if the eventTime  of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events  when the eventTime is older than 90 days.  If you decrease the retention period of an event data store, CloudTrail will remove any events with an eventTime older than the new retention period. For example, if the previous  retention period was 365 days and you decrease it to 100 days, CloudTrail  will remove events with an eventTime older than 100 days.
        public let retentionPeriod: Int?
        /// Indicates that termination protection is enabled and the event data store cannot be automatically deleted.
        public let terminationProtectionEnabled: Bool?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, eventDataStore: String, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, terminationProtectionEnabled: Bool? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.eventDataStore = eventDataStore
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.terminationProtectionEnabled = terminationProtectionEnabled
        }

        public func validate(name: String) throws {
            try self.advancedEventSelectors?.forEach {
                try $0.validate(name: "\(name).advancedEventSelectors[]")
            }
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, max: 256)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, min: 3)
            try self.validate(self.eventDataStore, name: "eventDataStore", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, max: 350)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, min: 1)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, pattern: "^[a-zA-Z0-9._/\\-:]+$")
            try self.validate(self.name, name: "name", parent: name, max: 128)
            try self.validate(self.name, name: "name", parent: name, min: 3)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9._\\-]+$")
            try self.validate(self.retentionPeriod, name: "retentionPeriod", parent: name, max: 3653)
            try self.validate(self.retentionPeriod, name: "retentionPeriod", parent: name, min: 7)
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case eventDataStore = "EventDataStore"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
        }
    }

    public struct UpdateEventDataStoreResponse: AWSDecodableShape {
        /// The advanced event selectors that are applied to the event data store.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The billing mode for the event data store.
        public let billingMode: BillingMode?
        /// The timestamp that shows when an event data store was first created.
        public let createdTimestamp: Date?
        /// The ARN of the event data store.
        public let eventDataStoreArn: String?
        ///  If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store.
        public let federationRoleArn: String?
        ///  Indicates the Lake query federation status. The status is  ENABLED if Lake query federation is enabled, or DISABLED if Lake query federation is disabled. You cannot delete an event data store if the FederationStatus is ENABLED.
        public let federationStatus: FederationStatus?
        /// Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created.
        public let multiRegionEnabled: Bool?
        /// The name of the event data store.
        public let name: String?
        /// Indicates whether an event data store is collecting logged events for an organization in Organizations.
        public let organizationEnabled: Bool?
        /// The retention period, in days.
        public let retentionPeriod: Int?
        /// The status of an event data store.
        public let status: EventDataStoreStatus?
        /// Indicates whether termination protection is enabled for the event data store.
        public let terminationProtectionEnabled: Bool?
        /// The timestamp that shows when the event data store was last updated. UpdatedTimestamp is always either the same or newer than the time shown in CreatedTimestamp.
        public let updatedTimestamp: Date?

        @inlinable
        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, billingMode: BillingMode? = nil, createdTimestamp: Date? = nil, eventDataStoreArn: String? = nil, federationRoleArn: String? = nil, federationStatus: FederationStatus? = nil, kmsKeyId: String? = nil, multiRegionEnabled: Bool? = nil, name: String? = nil, organizationEnabled: Bool? = nil, retentionPeriod: Int? = nil, status: EventDataStoreStatus? = nil, terminationProtectionEnabled: Bool? = nil, updatedTimestamp: Date? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.billingMode = billingMode
            self.createdTimestamp = createdTimestamp
            self.eventDataStoreArn = eventDataStoreArn
            self.federationRoleArn = federationRoleArn
            self.federationStatus = federationStatus
            self.kmsKeyId = kmsKeyId
            self.multiRegionEnabled = multiRegionEnabled
            self.name = name
            self.organizationEnabled = organizationEnabled
            self.retentionPeriod = retentionPeriod
            self.status = status
            self.terminationProtectionEnabled = terminationProtectionEnabled
            self.updatedTimestamp = updatedTimestamp
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case billingMode = "BillingMode"
            case createdTimestamp = "CreatedTimestamp"
            case eventDataStoreArn = "EventDataStoreArn"
            case federationRoleArn = "FederationRoleArn"
            case federationStatus = "FederationStatus"
            case kmsKeyId = "KmsKeyId"
            case multiRegionEnabled = "MultiRegionEnabled"
            case name = "Name"
            case organizationEnabled = "OrganizationEnabled"
            case retentionPeriod = "RetentionPeriod"
            case status = "Status"
            case terminationProtectionEnabled = "TerminationProtectionEnabled"
            case updatedTimestamp = "UpdatedTimestamp"
        }
    }

    public struct UpdateTrailRequest: AWSEncodableShape {
        /// Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered. You must use a log group that exists in your account. Not required unless you specify CloudWatchLogsRoleArn.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether log file validation is enabled. The default is false.  When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
        public let enableLogFileValidation: Bool?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail applies only to the current Region or to all Regions. The default is false. If the trail exists only in the current Region and this value is set to true, shadow trails (replications of the trail) will be created in the other Regions. If the trail exists in all Regions and this value is set to false, the trail will remain in the Region where it was created, and its shadow trails in other Regions will be deleted. As a best practice, consider using trails that log events in all Regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is applied to all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations. If the trail is not an organization trail and this is set to true, the trail will be created in all Amazon Web Services accounts that belong to the organization. If the trail is an organization trail and this is set to false, the trail will remain in the current Amazon Web Services account but be deleted from all member accounts in the organization.  Only the management account for the organization can convert an organization trail to a non-organization trail, or convert a non-organization trail to  an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide. Examples:   alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012   12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies the name of the trail or trail ARN. If Name is a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If Name is a trail ARN, it must be in the following format.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket naming rules.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.
        public let snsTopicName: String?

        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, enableLogFileValidation: Bool? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, name: String, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicName: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.enableLogFileValidation = enableLogFileValidation
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicName = snsTopicName
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case enableLogFileValidation = "EnableLogFileValidation"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicName = "SnsTopicName"
        }
    }

    public struct UpdateTrailResponse: AWSDecodableShape {
        /// Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs are delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists in one Region or in all Regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format.  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file integrity validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Specifies the name of the trail.
        public let name: String?
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your IAM Log Files.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN.  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// This field is no longer in use. Use SnsTopicARN.
        public let snsTopicName: String?
        /// Specifies the ARN of the trail that was updated. The following is the format of a trail ARN.  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = nil
            self.trailARN = trailARN
        }

        @available(*, deprecated, message: "Members snsTopicName have been deprecated")
        @inlinable
        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, snsTopicName: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.snsTopicName = snsTopicName
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case snsTopicName = "SnsTopicName"
            case trailARN = "TrailARN"
        }
    }

    public struct Widget: AWSDecodableShape {
        /// The query alias used to identify the query for the widget.
        public let queryAlias: String?
        ///  The query parameters for the widget.
        public let queryParameters: [String]?
        /// The SQL query statement for the widget.
        public let queryStatement: String?
        ///  The view properties for the widget. For more information about view properties, see  View properties for widgets in the CloudTrail User Guide..
        public let viewProperties: [String: String]?

        @inlinable
        public init(queryAlias: String? = nil, queryParameters: [String]? = nil, queryStatement: String? = nil, viewProperties: [String: String]? = nil) {
            self.queryAlias = queryAlias
            self.queryParameters = queryParameters
            self.queryStatement = queryStatement
            self.viewProperties = viewProperties
        }

        private enum CodingKeys: String, CodingKey {
            case queryAlias = "QueryAlias"
            case queryParameters = "QueryParameters"
            case queryStatement = "QueryStatement"
            case viewProperties = "ViewProperties"
        }
    }
}

// MARK: - Errors

/// Error enum for CloudTrail
public struct CloudTrailErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case accountHasOngoingImportException = "AccountHasOngoingImportException"
        case accountNotFoundException = "AccountNotFoundException"
        case accountNotRegisteredException = "AccountNotRegisteredException"
        case accountRegisteredException = "AccountRegisteredException"
        case cannotDelegateManagementAccountException = "CannotDelegateManagementAccountException"
        case channelARNInvalidException = "ChannelARNInvalidException"
        case channelAlreadyExistsException = "ChannelAlreadyExistsException"
        case channelExistsForEDSException = "ChannelExistsForEDSException"
        case channelMaxLimitExceededException = "ChannelMaxLimitExceededException"
        case channelNotFoundException = "ChannelNotFoundException"
        case cloudTrailARNInvalidException = "CloudTrailARNInvalidException"
        case cloudTrailAccessNotEnabledException = "CloudTrailAccessNotEnabledException"
        case cloudTrailInvalidClientTokenIdException = "CloudTrailInvalidClientTokenIdException"
        case cloudWatchLogsDeliveryUnavailableException = "CloudWatchLogsDeliveryUnavailableException"
        case concurrentModificationException = "ConcurrentModificationException"
        case conflictException = "ConflictException"
        case delegatedAdminAccountLimitExceededException = "DelegatedAdminAccountLimitExceededException"
        case eventDataStoreARNInvalidException = "EventDataStoreARNInvalidException"
        case eventDataStoreAlreadyExistsException = "EventDataStoreAlreadyExistsException"
        case eventDataStoreFederationEnabledException = "EventDataStoreFederationEnabledException"
        case eventDataStoreHasOngoingImportException = "EventDataStoreHasOngoingImportException"
        case eventDataStoreMaxLimitExceededException = "EventDataStoreMaxLimitExceededException"
        case eventDataStoreNotFoundException = "EventDataStoreNotFoundException"
        case eventDataStoreTerminationProtectedException = "EventDataStoreTerminationProtectedException"
        case generateResponseException = "GenerateResponseException"
        case importNotFoundException = "ImportNotFoundException"
        case inactiveEventDataStoreException = "InactiveEventDataStoreException"
        case inactiveQueryException = "InactiveQueryException"
        case insightNotEnabledException = "InsightNotEnabledException"
        case insufficientDependencyServiceAccessPermissionException = "InsufficientDependencyServiceAccessPermissionException"
        case insufficientEncryptionPolicyException = "InsufficientEncryptionPolicyException"
        case insufficientIAMAccessPermissionException = "InsufficientIAMAccessPermissionException"
        case insufficientS3BucketPolicyException = "InsufficientS3BucketPolicyException"
        case insufficientSnsTopicPolicyException = "InsufficientSnsTopicPolicyException"
        case invalidCloudWatchLogsLogGroupArnException = "InvalidCloudWatchLogsLogGroupArnException"
        case invalidCloudWatchLogsRoleArnException = "InvalidCloudWatchLogsRoleArnException"
        case invalidDateRangeException = "InvalidDateRangeException"
        case invalidEventCategoryException = "InvalidEventCategoryException"
        case invalidEventDataStoreCategoryException = "InvalidEventDataStoreCategoryException"
        case invalidEventDataStoreStatusException = "InvalidEventDataStoreStatusException"
        case invalidEventSelectorsException = "InvalidEventSelectorsException"
        case invalidHomeRegionException = "InvalidHomeRegionException"
        case invalidImportSourceException = "InvalidImportSourceException"
        case invalidInsightSelectorsException = "InvalidInsightSelectorsException"
        case invalidKmsKeyIdException = "InvalidKmsKeyIdException"
        case invalidLookupAttributesException = "InvalidLookupAttributesException"
        case invalidMaxResultsException = "InvalidMaxResultsException"
        case invalidNextTokenException = "InvalidNextTokenException"
        case invalidParameterCombinationException = "InvalidParameterCombinationException"
        case invalidParameterException = "InvalidParameterException"
        case invalidQueryStatementException = "InvalidQueryStatementException"
        case invalidQueryStatusException = "InvalidQueryStatusException"
        case invalidS3BucketNameException = "InvalidS3BucketNameException"
        case invalidS3PrefixException = "InvalidS3PrefixException"
        case invalidSnsTopicNameException = "InvalidSnsTopicNameException"
        case invalidSourceException = "InvalidSourceException"
        case invalidTagParameterException = "InvalidTagParameterException"
        case invalidTimeRangeException = "InvalidTimeRangeException"
        case invalidTokenException = "InvalidTokenException"
        case invalidTrailNameException = "InvalidTrailNameException"
        case kmsException = "KmsException"
        case kmsKeyDisabledException = "KmsKeyDisabledException"
        case kmsKeyNotFoundException = "KmsKeyNotFoundException"
        case maxConcurrentQueriesException = "MaxConcurrentQueriesException"
        case maximumNumberOfTrailsExceededException = "MaximumNumberOfTrailsExceededException"
        case noManagementAccountSLRExistsException = "NoManagementAccountSLRExistsException"
        case notOrganizationManagementAccountException = "NotOrganizationManagementAccountException"
        case notOrganizationMasterAccountException = "NotOrganizationMasterAccountException"
        case operationNotPermittedException = "OperationNotPermittedException"
        case organizationNotInAllFeaturesModeException = "OrganizationNotInAllFeaturesModeException"
        case organizationsNotInUseException = "OrganizationsNotInUseException"
        case queryIdNotFoundException = "QueryIdNotFoundException"
        case resourceARNNotValidException = "ResourceARNNotValidException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case resourcePolicyNotFoundException = "ResourcePolicyNotFoundException"
        case resourcePolicyNotValidException = "ResourcePolicyNotValidException"
        case resourceTypeNotSupportedException = "ResourceTypeNotSupportedException"
        case s3BucketDoesNotExistException = "S3BucketDoesNotExistException"
        case serviceQuotaExceededException = "ServiceQuotaExceededException"
        case tagsLimitExceededException = "TagsLimitExceededException"
        case throttlingException = "ThrottlingException"
        case trailAlreadyExistsException = "TrailAlreadyExistsException"
        case trailNotFoundException = "TrailNotFoundException"
        case trailNotProvidedException = "TrailNotProvidedException"
        case unsupportedOperationException = "UnsupportedOperationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize CloudTrail
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    ///  You do not have sufficient access to perform this action.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    ///  This exception is thrown when you start a new import and a previous import is still in progress.
    public static var accountHasOngoingImportException: Self { .init(.accountHasOngoingImportException) }
    /// This exception is thrown when the specified account is not found or not part of an organization.
    public static var accountNotFoundException: Self { .init(.accountNotFoundException) }
    /// This exception is thrown when the specified account is not registered as the CloudTrail delegated administrator.
    public static var accountNotRegisteredException: Self { .init(.accountNotRegisteredException) }
    /// This exception is thrown when the account is already registered as the CloudTrail delegated administrator.
    public static var accountRegisteredException: Self { .init(.accountRegisteredException) }
    /// This exception is thrown when the management account of an organization is registered as the CloudTrail delegated administrator.
    public static var cannotDelegateManagementAccountException: Self { .init(.cannotDelegateManagementAccountException) }
    /// This exception is thrown when the specified value of ChannelARN is not valid.
    public static var channelARNInvalidException: Self { .init(.channelARNInvalidException) }
    ///  This exception is thrown when the provided channel already exists.
    public static var channelAlreadyExistsException: Self { .init(.channelAlreadyExistsException) }
    /// This exception is thrown when the specified event data store cannot yet be deleted because it  is in use by a channel.
    public static var channelExistsForEDSException: Self { .init(.channelExistsForEDSException) }
    ///  This exception is thrown when the maximum number of channels limit is exceeded.
    public static var channelMaxLimitExceededException: Self { .init(.channelMaxLimitExceededException) }
    /// This exception is thrown when CloudTrail cannot find the specified channel.
    public static var channelNotFoundException: Self { .init(.channelNotFoundException) }
    /// This exception is thrown when an operation is called with an ARN that is not valid. The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  The following is the format of a dashboard ARN: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
    public static var cloudTrailARNInvalidException: Self { .init(.cloudTrailARNInvalidException) }
    /// This exception is thrown when trusted access has not been enabled between CloudTrail and Organizations. For more information, see How to enable or disable trusted access in the Organizations User Guide and Prepare For Creating a Trail For Your Organization in the CloudTrail User Guide.
    public static var cloudTrailAccessNotEnabledException: Self { .init(.cloudTrailAccessNotEnabledException) }
    /// This exception is thrown when a call results in the InvalidClientTokenId error code. This can occur when you are creating or updating a trail to send notifications to an Amazon SNS topic that is in a suspended Amazon Web Services account.
    public static var cloudTrailInvalidClientTokenIdException: Self { .init(.cloudTrailInvalidClientTokenIdException) }
    /// Cannot set a CloudWatch Logs delivery for this Region.
    public static var cloudWatchLogsDeliveryUnavailableException: Self { .init(.cloudWatchLogsDeliveryUnavailableException) }
    ///  You are trying to update a resource when another request is in progress. Allow sufficient wait time for the previous request to complete, then retry your request.
    public static var concurrentModificationException: Self { .init(.concurrentModificationException) }
    /// This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.
    public static var conflictException: Self { .init(.conflictException) }
    /// This exception is thrown when the maximum number of CloudTrail delegated administrators is reached.
    public static var delegatedAdminAccountLimitExceededException: Self { .init(.delegatedAdminAccountLimitExceededException) }
    /// The specified event data store ARN is not valid or does not map to an event data store in your account.
    public static var eventDataStoreARNInvalidException: Self { .init(.eventDataStoreARNInvalidException) }
    /// An event data store with that name already exists.
    public static var eventDataStoreAlreadyExistsException: Self { .init(.eventDataStoreAlreadyExistsException) }
    ///  You cannot delete the event data store because Lake query federation is enabled. To delete the event data store, run the DisableFederation operation to  disable Lake query federation on the event data store.
    public static var eventDataStoreFederationEnabledException: Self { .init(.eventDataStoreFederationEnabledException) }
    ///  This exception is thrown when you try to update or delete an event data store that currently has an import in progress.
    public static var eventDataStoreHasOngoingImportException: Self { .init(.eventDataStoreHasOngoingImportException) }
    /// Your account has used the maximum number of event data stores.
    public static var eventDataStoreMaxLimitExceededException: Self { .init(.eventDataStoreMaxLimitExceededException) }
    /// The specified event data store was not found.
    public static var eventDataStoreNotFoundException: Self { .init(.eventDataStoreNotFoundException) }
    /// The event data store cannot be deleted because termination protection is enabled for it.
    public static var eventDataStoreTerminationProtectedException: Self { .init(.eventDataStoreTerminationProtectedException) }
    ///  This exception is thrown when a valid query could not be generated for the provided prompt.
    public static var generateResponseException: Self { .init(.generateResponseException) }
    ///  The specified import was not found.
    public static var importNotFoundException: Self { .init(.importNotFoundException) }
    /// The event data store is inactive.
    public static var inactiveEventDataStoreException: Self { .init(.inactiveEventDataStoreException) }
    /// The specified query cannot be canceled because it is in the FINISHED, FAILED, TIMED_OUT, or CANCELLED state.
    public static var inactiveQueryException: Self { .init(.inactiveQueryException) }
    /// If you run GetInsightSelectors on a trail or event data store that does not have Insights events enabled, the operation throws the exception InsightNotEnabledException.
    public static var insightNotEnabledException: Self { .init(.insightNotEnabledException) }
    /// This exception is thrown when the IAM identity that is used to create the organization resource lacks one or more required permissions for creating an organization resource in a required service.
    public static var insufficientDependencyServiceAccessPermissionException: Self { .init(.insufficientDependencyServiceAccessPermissionException) }
    /// For the CreateTrail PutInsightSelectors, UpdateTrail, StartQuery, and StartImport operations, this exception is thrown  when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation. For all other operations, this exception is thrown when the policy for the KMS key does not have sufficient permissions for the operation.
    public static var insufficientEncryptionPolicyException: Self { .init(.insufficientEncryptionPolicyException) }
    /// The task can't be completed because you are signed in with an account that lacks permissions to view or create a service-linked role. Sign in with an account that has the required permissions and then try again.
    public static var insufficientIAMAccessPermissionException: Self { .init(.insufficientIAMAccessPermissionException) }
    /// This exception is thrown when the policy on the S3 bucket is not sufficient.
    public static var insufficientS3BucketPolicyException: Self { .init(.insufficientS3BucketPolicyException) }
    /// This exception is thrown when the policy on the Amazon SNS topic is not sufficient.
    public static var insufficientSnsTopicPolicyException: Self { .init(.insufficientSnsTopicPolicyException) }
    /// This exception is thrown when the provided CloudWatch Logs log group is not valid.
    public static var invalidCloudWatchLogsLogGroupArnException: Self { .init(.invalidCloudWatchLogsLogGroupArnException) }
    /// This exception is thrown when the provided role is not valid.
    public static var invalidCloudWatchLogsRoleArnException: Self { .init(.invalidCloudWatchLogsRoleArnException) }
    /// A date range for the query was specified that is not valid. Be sure that the start time is chronologically before the end time. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.
    public static var invalidDateRangeException: Self { .init(.invalidDateRangeException) }
    /// Occurs if an event category that is not valid is specified as a value of EventCategory.
    public static var invalidEventCategoryException: Self { .init(.invalidEventCategoryException) }
    /// This exception is thrown when event categories of specified event data stores are not valid.
    public static var invalidEventDataStoreCategoryException: Self { .init(.invalidEventDataStoreCategoryException) }
    /// The event data store is not in a status that supports the operation.
    public static var invalidEventDataStoreStatusException: Self { .init(.invalidEventDataStoreStatusException) }
    /// This exception is thrown when the PutEventSelectors operation is called with a number of event selectors, advanced event selectors, or data resources that is not valid. The combination of event selectors or advanced event selectors and data resources is not valid. A trail can have up to 5 event selectors. If a trail uses advanced event selectors, a maximum of 500 total values for all conditions in all advanced event selectors is allowed. A trail is limited to 250 data resources. These data resources can be distributed across event selectors, but the overall total cannot exceed 250. You can:   Specify a valid number of event selectors (1 to 5) for a trail.   Specify a valid number of data resources (1 to 250) for an event selector. The limit of number of resources on an individual event selector is configurable up to 250. However, this upper limit is allowed only if the total number of data resources does not exceed 250 across all event selectors for a trail.   Specify up to 500 values for all conditions in all advanced event selectors for a trail.   Specify a valid value for a parameter. For example, specifying the ReadWriteType parameter with a value of read-only is not valid.
    public static var invalidEventSelectorsException: Self { .init(.invalidEventSelectorsException) }
    /// This exception is thrown when an operation is called on a trail from a Region other than the Region in which the trail was created.
    public static var invalidHomeRegionException: Self { .init(.invalidHomeRegionException) }
    ///  This exception is thrown when the provided source S3 bucket is not valid for import.
    public static var invalidImportSourceException: Self { .init(.invalidImportSourceException) }
    /// For PutInsightSelectors, this exception is thrown when the formatting or syntax of the InsightSelectors JSON statement is not valid, or the specified InsightType in the InsightSelectors statement is not valid. Valid values for InsightType are ApiCallRateInsight and ApiErrorRateInsight. To enable Insights on an event data store, the destination event data store specified by the  InsightsDestination parameter must log Insights events and the source event data  store specified by the EventDataStore parameter must log management events. For UpdateEventDataStore, this exception is thrown if Insights are enabled on the event data store and the updated  advanced event selectors are not compatible with the configured InsightSelectors.  If the InsightSelectors includes an InsightType of ApiCallRateInsight, the source event data store must log write management events.  If the InsightSelectors includes an InsightType of ApiErrorRateInsight, the source event data store must log management events.
    public static var invalidInsightSelectorsException: Self { .init(.invalidInsightSelectorsException) }
    /// This exception is thrown when the KMS key ARN is not valid.
    public static var invalidKmsKeyIdException: Self { .init(.invalidKmsKeyIdException) }
    /// Occurs when a lookup attribute is specified that is not valid.
    public static var invalidLookupAttributesException: Self { .init(.invalidLookupAttributesException) }
    /// This exception is thrown if the limit specified is not valid.
    public static var invalidMaxResultsException: Self { .init(.invalidMaxResultsException) }
    /// A token that is not valid, or a token that was previously used in a request with different parameters. This exception is thrown if the token is not valid.
    public static var invalidNextTokenException: Self { .init(.invalidNextTokenException) }
    /// This exception is thrown when the combination of parameters provided is not valid.
    public static var invalidParameterCombinationException: Self { .init(.invalidParameterCombinationException) }
    /// The request includes a parameter that is not valid.
    public static var invalidParameterException: Self { .init(.invalidParameterException) }
    /// The query that was submitted has validation errors, or uses incorrect syntax or unsupported keywords. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.
    public static var invalidQueryStatementException: Self { .init(.invalidQueryStatementException) }
    /// The query status is not valid for the operation.
    public static var invalidQueryStatusException: Self { .init(.invalidQueryStatusException) }
    /// This exception is thrown when the provided S3 bucket name is not valid.
    public static var invalidS3BucketNameException: Self { .init(.invalidS3BucketNameException) }
    /// This exception is thrown when the provided S3 prefix is not valid.
    public static var invalidS3PrefixException: Self { .init(.invalidS3PrefixException) }
    /// This exception is thrown when the provided SNS topic name is not valid.
    public static var invalidSnsTopicNameException: Self { .init(.invalidSnsTopicNameException) }
    /// This exception is thrown when the specified value of Source is not valid.
    public static var invalidSourceException: Self { .init(.invalidSourceException) }
    /// This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.
    public static var invalidTagParameterException: Self { .init(.invalidTagParameterException) }
    /// Occurs if the timestamp values are not valid. Either the start time occurs after the end time, or the time range is outside the range of possible values.
    public static var invalidTimeRangeException: Self { .init(.invalidTimeRangeException) }
    /// Reserved for future use.
    public static var invalidTokenException: Self { .init(.invalidTokenException) }
    /// This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)
    public static var invalidTrailNameException: Self { .init(.invalidTrailNameException) }
    /// This exception is thrown when there is an issue with the specified KMS key and the trail or event data store can't be updated.
    public static var kmsException: Self { .init(.kmsException) }
    /// This exception is no longer in use.
    public static var kmsKeyDisabledException: Self { .init(.kmsKeyDisabledException) }
    /// This exception is thrown when the KMS key does not exist, when the S3 bucket and the KMS key are not in the same Region, or when the KMS key associated with the Amazon SNS topic either does not exist or is not in the same Region.
    public static var kmsKeyNotFoundException: Self { .init(.kmsKeyNotFoundException) }
    /// You are already running the maximum number of concurrent queries. The maximum number of concurrent queries is 10. Wait a minute for some queries to finish, and then run the query again.
    public static var maxConcurrentQueriesException: Self { .init(.maxConcurrentQueriesException) }
    /// This exception is thrown when the maximum number of trails is reached.
    public static var maximumNumberOfTrailsExceededException: Self { .init(.maximumNumberOfTrailsExceededException) }
    ///  This exception is thrown when the management account does not have a service-linked role.
    public static var noManagementAccountSLRExistsException: Self { .init(.noManagementAccountSLRExistsException) }
    ///  This exception is thrown when the account making the request is not the organization's management account.
    public static var notOrganizationManagementAccountException: Self { .init(.notOrganizationManagementAccountException) }
    /// This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.
    public static var notOrganizationMasterAccountException: Self { .init(.notOrganizationMasterAccountException) }
    /// This exception is thrown when the requested operation is not permitted.
    public static var operationNotPermittedException: Self { .init(.operationNotPermittedException) }
    /// This exception is thrown when Organizations is not configured to support all features. All features must be enabled in Organizations to support creating an organization trail or event data store.
    public static var organizationNotInAllFeaturesModeException: Self { .init(.organizationNotInAllFeaturesModeException) }
    /// This exception is thrown when the request is made from an Amazon Web Services account that is not a member of an organization. To make this request, sign in using the credentials of an account that belongs to an organization.
    public static var organizationsNotInUseException: Self { .init(.organizationsNotInUseException) }
    /// The query ID does not exist or does not map to a query.
    public static var queryIdNotFoundException: Self { .init(.queryIdNotFoundException) }
    ///  This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid.  The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE  The following is the format of a dashboard ARN: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash  The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890
    public static var resourceARNNotValidException: Self { .init(.resourceARNNotValidException) }
    /// This exception is thrown when the specified resource is not found.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    ///  This exception is thrown when the specified resource policy is not found.
    public static var resourcePolicyNotFoundException: Self { .init(.resourcePolicyNotFoundException) }
    ///  This exception is thrown when the resouce-based policy has syntax errors, or contains a principal that is not valid.
    public static var resourcePolicyNotValidException: Self { .init(.resourcePolicyNotValidException) }
    /// This exception is thrown when the specified resource type is not supported by CloudTrail.
    public static var resourceTypeNotSupportedException: Self { .init(.resourceTypeNotSupportedException) }
    /// This exception is thrown when the specified S3 bucket does not exist.
    public static var s3BucketDoesNotExistException: Self { .init(.s3BucketDoesNotExistException) }
    ///  This exception is thrown when the quota is exceeded. For information about CloudTrail quotas, see Service quotas  in the Amazon Web Services General Reference.
    public static var serviceQuotaExceededException: Self { .init(.serviceQuotaExceededException) }
    /// The number of tags per trail, event data store, dashboard, or channel has exceeded the permitted amount. Currently, the limit is 50.
    public static var tagsLimitExceededException: Self { .init(.tagsLimitExceededException) }
    ///  This exception is thrown when the request rate exceeds the limit.
    public static var throttlingException: Self { .init(.throttlingException) }
    /// This exception is thrown when the specified trail already exists.
    public static var trailAlreadyExistsException: Self { .init(.trailAlreadyExistsException) }
    /// This exception is thrown when the trail with the given name is not found.
    public static var trailNotFoundException: Self { .init(.trailNotFoundException) }
    /// This exception is no longer in use.
    public static var trailNotProvidedException: Self { .init(.trailNotProvidedException) }
    /// This exception is thrown when the requested operation is not supported.
    public static var unsupportedOperationException: Self { .init(.unsupportedOperationException) }
}

extension CloudTrailErrorType: Equatable {
    public static func == (lhs: CloudTrailErrorType, rhs: CloudTrailErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension CloudTrailErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
